Questions tagged [fslex]

Fslex is a F# variant of lex, a program that generates lexical analyzers ("scanners" or "lexers"). Fslex is commonly used with fsyacc, the parser generator.

Fslex is a F# variant of lex, a program that generates lexical analyzers ("scanners" or "lexers"). Fslex is commonly used with the fsyacc parser generator.

Fslex is included in F# PowerPack; for detailed documentation, please visit http://fsharppowerpack.codeplex.com/wikipage?title=FsLex%20Documentation

43 questions
37
votes
1 answer

Lexing and parsing concurrently in F#

Is there an easy way to get lexing and parsing to run concurrently when using fslex and fsyacc?
J D
  • 48,105
  • 13
  • 171
  • 274
10
votes
3 answers

F# fslex fsyacc mature for production code?

After reading a 2 year old webpage really ripping fslex/fsyacc, buggy, slow, stupid etc. compared to their OCamel counterparts i wonder what would be ones best bet for lexing parsing needs? Ive used ANTLR before with C# bindings but am currently in…
Jeps
  • 123
  • 2
  • 5
8
votes
2 answers

What is the difference between lex/yacc and fslex/fsyacc?

I'm learning F# because I'd like to write a lexer and parser. I have a tiny bit of experience with this sort of processing but really need to learn it properly as well as F#. When learning the lexing/parsing functionality of F#, is studying lex and…
Alex Angas
  • 59,219
  • 41
  • 137
  • 210
6
votes
1 answer

Lua long strings in fslex

I've been working on a Lua fslex lexer in my spare time, using the ocamllex manual as a reference. I hit a few snags while trying to tokenize long strings correctly. "Long strings" are delimited by '[' ('=')* '[' and ']' ('=')* ']' tokens; the…
raine
  • 817
  • 1
  • 15
  • 26
6
votes
3 answers

Expecting a LexBuffer but given a LexBuffer The type 'char' does not match the type 'byte'

Type mismatch. Expecting a LexBuffer but given a LexBuffer The type 'char' does not match the type 'byte' This is the error message that I am getting while using fslex. I have tried manually checking every single…
csprabala
  • 177
  • 12
5
votes
3 answers

FSLex example solution?

I've been using C/lex for a long time and would like to use F#/fslex now. I'm comparably well off in C# and in the process of learning F#. The only thing is that I can't see any project example or template where fslex is properly included in the…
Volker
  • 51
  • 2
4
votes
3 answers

How to capture a string without quote characters

I'm trying to capture quoted strings without the quotes. I have this terminal %token STRING and this production constant: | QUOTE STRING QUOTE { String($2) } along with these lexer rules | '\'' { QUOTE } | [^ '\'']* { STRING…
Daniel
  • 47,404
  • 11
  • 101
  • 179
4
votes
3 answers

What to choose fsyacc/fslex or FParsec?

I need to parse simple DSL language like the following: import "library.txt" def main(int param1, bool param2) { var a = f4(param1); // or var d = f1(f2(f3(f4(param1)))); var b = f3(a); var c = f2(b); var d =…
Evgeny Gavrin
  • 7,627
  • 1
  • 22
  • 27
4
votes
1 answer

fslex - How to switch between two token sets?

I'm trying to write a small DSL parser using fslex and fsyacc. The input is composed of interleaving chunks of two different languages which require different lexing rules. How do I write my fslex file to support that? (I guess a similar case would…
Aviad P.
  • 32,036
  • 14
  • 103
  • 124
4
votes
3 answers

How to return multiple tokens for one fslex rule pattern?

Using fslex I would like to return multiple tokens for one pattern but I don't see a way how to accomplish that. Even to use another rule function that returns multiple tokens would work for me. I am trying to use something like this: let identifier…
kongo2002
  • 1,006
  • 5
  • 11
3
votes
1 answer

Getting FS0035 => Construct is deprecated

In a fsyacc based project, I have this line: type 'a cucomment = string This is the full error description I'm getting: CALast.fs(117,9): error FS0035: This construct is deprecated: This type abbreviation has one or more declared type…
pietervp
  • 225
  • 1
  • 7
3
votes
0 answers

How to setup Visual Studio/JetBrains Rider for interpreter development in F#?

For a while now I have been experiencing issues with configuring IDE`s (Visual Studio and JetBrains Rider) to include FsLexYacc packages and etc. to start learning interpreter development. I have been following this guide at GitHub of how to add…
alex_z
  • 416
  • 5
  • 12
3
votes
1 answer

FsLex aborts with parse error on '{'

My Lexer is supposed to distinguish brackets and maintain a stack of opened brackets during lexing. For this I specified a helper function in my fsl file like this: let updateBracketStack sign = // whenever a bracket is parsed, update the stack…
Friedrich Gretz
  • 535
  • 4
  • 14
3
votes
2 answers

FsLex changed with latest PowerPack?

I've been working on a compiler for a while but after changing to PowerPack 1.9.9.9 and the release version of VS2010 I'm no unable to compile the following line: let lexbuf = Lexing.from_string text I get the following two error: "The value,…
Rune FS
  • 21,497
  • 7
  • 62
  • 96
3
votes
0 answers

Creating Simple Parser in F#

I am currently attempting to create an extremely simple parser in F# using FsLex and FsYacc. At first, the only functionality I am trying to achieve is allowing the program to take in a string that represents addition of integers and output a…
Avery B
  • 237
  • 1
  • 11
1
2 3