Search code examples
visual-studiof#fslex

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: <code>", where do I add this code?

And I don't even know where to put Lexer.fsl.

I would like to know the procedure for creating a project using FsLexYacc.


Solution

  • There's a small sample project here and documentation here that should be enough to get you started. You add the FsLex and FsYacc entries to the .fsproj project file. It looks like you put Lexer.fsl in the same directory as your F# source code (e.g. Program.fs).