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
1
vote
2 answers

Crazy errors with FsLex and FsYacc

I am trying to compile this project: http://ramon.org.il/Here.zip But I get a bunch of non-sense errors. They got text I am familiar with, but in the position there is nothing like that (like unexpected ')' at an empty row). Help me, please!
Ramon Snir
  • 7,520
  • 3
  • 43
  • 61
1
vote
0 answers

fslex - matching issues line terminator

please consider this piece of a lexer I am constructing: let newline = "\n\r" | '\n' | '\r' let dot = "\." let lineTerminator = "\."newline rule tokenize = parse ... | lineTerminator { lexbuf.EndPos <- lexbuf.EndPos.NextLine; tokenize lexbuf;…
flq
  • 22,247
  • 8
  • 55
  • 77
1
vote
1 answer

How to make FsLex rules tail-recursive / prevent StackOverflowExceptions

I'm implementing a scripting language with fslex / fsyacc and have a problem with large user inputs (i.e. >1k scripts), specifically this error occurs when the lexer analyzes a very large string. I scan strings in a custom lexer function (to allow…
enzi
  • 4,057
  • 3
  • 35
  • 53
0
votes
1 answer

How to use FsLexYacc with Visual Studio 2022 in F#?

I decided to use FsLexYacc for parsing in F#. So I downloaded it with the NuGet package in Visual Studio, I have no idea how to use it. This link says "You then add FsLex and FsYacc entries like this: ", where do I add this code? And I don't…
thglafls
  • 25
  • 4
0
votes
1 answer

Given a lexer implemented in FsLexYacc, how do I get all of the tokens?

I have a lexer and parser implemented in FsLexYacc. To debug the lexer, I would like to print all of the tokens for a given string. Here is what I have so far: #load "../.paket/load/net5.0/FsLexYacc.Runtime.fsx" #load "./Domain.fs" #load…
sdgfsdh
  • 33,689
  • 26
  • 132
  • 245
0
votes
1 answer

FsLexYacc compile errors?

I'm trying to setup a new project in F#. I'm using FsLexYacc as a tool, and last time i used it was when the Fsharp powerpack was 'in'. The documentation on the site are not that good. It also seems to me that there is a bug with the generic type…
kam
  • 590
  • 2
  • 11
0
votes
1 answer

FsLex - Differ between 2 strings

I've a couple of tokens: PNAME and ENAME - both are strings. Now I want to setup 2 rules in my lexer, in order to match those tokens. The first rule (PNAME) should match when the string consist of characters a-z, and optional special characters…
ebb
  • 9,297
  • 18
  • 72
  • 123
0
votes
1 answer

How to specify unicode characters in patterns for fslex

What is the correct way to specify Unicode characters in pattern for FSharp Lexer. Following code is not compiled with the FsLex.exe utility: let lexeme lexbuf = LexBuffer.LexemeString lexbuf ... rule tokenize = parse | ['a'-'z' 'A'-'Z']…
Vitaliy
  • 2,744
  • 1
  • 24
  • 39
0
votes
1 answer

FsLex FsYacc: How to create a language with a multi-line comment

I am playing around with FsLex and FsYacc, which is based off of ocamllex and ocamlyacc. What is the best way to define a comment in a language? Do I create a comment token in my lex file? There are a few complications to to comments that I cannot…
Phillip Scott Givens
  • 5,256
  • 4
  • 32
  • 54
0
votes
2 answers

F# 2.0 with Powerpack 2.0, fslex error 1

In namespace RSLispV3.RunTime: http://pastebin.com/XNb9qi11 LispParser.fsy: http://pastebin.com/pymF1Vvm LispLexer.fsl: http://pastebin.com/pfXdDuxs I got in MSBuild the PowerPacks targets, calling them from the .fsprog. When building with VS2008 I…
Ramon Snir
  • 7,520
  • 3
  • 43
  • 61
0
votes
1 answer

FsLexYacc : Tests/MiniProject "incorrect Import in .fsproj"

On github, FsLexYacc project has a test dir. I try to set up the simplest one ("LexAndYaccMiniProject"). I follow these steps : 1/ Create an F# console app named "LexAndYaccMiniProject" 2/ Install package ("PM > Install-Package FsLexYacc" from VS…
FZed
  • 520
  • 3
  • 10
0
votes
2 answers

fslex learning: Lexer not advancing

I am currently learning about lexing and parsing (based on the F# toolset) based on a parsing a simple calculation and I am stuck in that my lexer is not advancing to consume the whole string: let lexeme = LexBuffer<_>.LexemeString // ... rule test…
flq
  • 22,247
  • 8
  • 55
  • 77
0
votes
1 answer

F# integer file directive

I've been using fslex and fsyacc, and the F# source files (.fs they generate from the lexer (.fsl) and parser (.fsp) rules refer to the original .fsl (and sometimes to the same .fs source file) all over the place with statement such as this (numbers…
Jwosty
  • 3,497
  • 2
  • 22
  • 50
1 2
3