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
3
votes
0 answers

Creating a Functional Parser in F# using Visual Studio 2013 with FsLex and FsYacc

I have been struggling for a while simply getting a parser to compile and work in F# Visual Studio 2013. I've read a lot of other posts already that seemed helpful, both on stack overflow and this page:…
Jason
  • 108
  • 6
3
votes
1 answer

Can I pass parameters to my fsyacc parser?

I know that it is possible to pass parameters to a lexer: rule tokenize scope = parse | whitespace { tokenize scope lexbuf } | newline { newline lexbuf; tokenize scope lexbuf } but I'm not able to…
enzi
  • 4,057
  • 3
  • 35
  • 53
2
votes
1 answer

Should I use Workflow or fsYacc?

I have a very simple DSL I need to parse on a .Net platform. Not being very experienced with parsers, I have been looking at examples using F# (fsLex, fsYacc, FParsec). I am not that familiar with F#, but do have some experience with Workflow and…
John
  • 511
  • 1
  • 5
  • 10
2
votes
0 answers

Fslex, binary file lexing

Is there any ability to lexemize binary file formats (e.g. jpeg images) with Fslex (with no readability lacks) or i should write my own lexer/use something like fparsec?
Kovalev
  • 31
  • 2
2
votes
1 answer

How to deal with nested comments in FsLex

There are single and multi-line comments available, like in C. How to describe the rules for the lexer to ignore all the comments, even nested, such as these: // comment /* nested comment /* and nested again? */ */ or like these: /* comment // one…
Evgeny Gavrin
  • 7,627
  • 1
  • 22
  • 27
2
votes
1 answer

What is that "arg00" in the type of LexBuffer.LexemeString?

What is that "arg00" in the type of Fsharp.Text.Lexing's LexBuffer.LexemeString? > LexBuffer.LexemeString;; val it : arg00:LexBuffer -> string
zell
  • 9,830
  • 10
  • 62
  • 115
2
votes
0 answers

My prebuild event command with reference to a library (from Nuget) does not compile the program

I've been learning F# for some time, and I wanted to try creating a small SQL parser. I have found a tutorial that explains how to do this through FsLex and FsYacc, however, the site does not give any download links. Under Visual Studio, via nuget,…
ino
  • 39
  • 5
2
votes
3 answers

F# Inline Function Specialization

My current project involves lexing and parsing script code, and as such I'm using fslex and fsyacc. Fslex LexBuffers can come in either LexBuffer and LexBuffer varieties, and I'd like to have the option to use both. In order to user…
Ben
  • 6,023
  • 1
  • 25
  • 40
2
votes
0 answers

FsLexYacc whitespace indentation

I'm trying to implement Python-like white-space indentation(read as: emit indent/dedent tokens where needed) with FsLexYacc. It seems like FsLexYacc is not able to use unput which is what the C/C++ examples for lexing white-space based indentation…
prydain
  • 365
  • 3
  • 11
2
votes
1 answer

Differentiate between 'minus' operator and negative numbers in F# lex/yacc parser

I am trying to parse a simple script language using FsLex and FsYacc, and I have a problem with distinguishing the minus operator from negative numbers. If I evaluate the term "1 - 2", the parser will return the desired AST:…
Pete
  • 12,206
  • 8
  • 54
  • 70
2
votes
1 answer

How to run fslex.exe from F# PowerPack 2.0.0.0 on Mac?

I am having trouble running FsLex from F# PowerPack 2.0.0.0 on Mac. When I simply run the program I see: $ mono /Library/Frameworks/Mono.framework/Versions/3.0.2/lib/mono/FSharpPowerPack-2.0.0.0/bin/fslex.exe Unhandled…
Daniel Trebbien
  • 38,421
  • 18
  • 121
  • 193
2
votes
1 answer

FSlex/FSyacc crash - can't locate FSharp.Core assembly

I'm having an issue with FSlex/FSyacc crashing on my machine. In context this is inside Visual Studio 11 beta running on Windows 8 Consumer Preview (32 bit) running inside a Parallels virtual machine. ------ Build started: Project: Basis,…
Bent Rasmussen
  • 5,538
  • 9
  • 44
  • 63
1
vote
1 answer

Why are the newline and the white space treated differently in the lexer specification?

I am using F#'s FsLex to generate a lexer. I have difficulties to understand the following two lines from a textbook. Why is the newline (\n) treated differently from the white space? In particular, what does "lexbuf.EndPos <-…
zell
  • 9,830
  • 10
  • 62
  • 115
1
vote
1 answer

Under the command line, how to compile a F# lexer and then run it on a Mac OS?

I do not find documents on the command line for compiling a F# source and then run it on a Mac OS. Here is what I tried, which did not work. First, I have a lexer specification file "ExprLex_hj.fsl". I generated the lexer using a strange command…
zell
  • 9,830
  • 10
  • 62
  • 115
1
vote
1 answer

FSLex Unknown Error

I got some problem with my FSLex which I can't solve... All I know is that fslex.exe exited with code 1... The F# code at the top was tested in F# Interactive, so the problem isn't there (I can't see how). Lexer: http://pastebin.com/qnDnUh59 And…
Ramon Snir
  • 7,520
  • 3
  • 43
  • 61