FsLexYacc.Template
1.0.1
See the version list below for details.
dotnet new install FsLexYacc.Template::1.0.1
FsLexYacc Template
This is a Template for the assignments in PRDAT that removes the need to use the FsLexYacc.Runtime.dll
file. It will allow you to compile the .fsy
and .fsl
using dotnet build
in the console. Note that some IDE builders might not work as they use specialized build commands.
It also allows you to run the entire thing from an .fsx
file, so you don't need to mess around in the console.
You can also just use the Program.fs
file if you don't want to use the .fsx
.
Install
Run the following to install the template:
dotnet new -i FsLexYacc.Template
How to make a project
Create a new project using the template.
dotnet new fslexyacc -o <project_name>
You can also use the
-o
flag to specify the output directory or use-n
if you just want it in the current folder.
How to set it up
Replace the
.fsy
and.fsl
with your own files and update the.csproj
file to match the new names.<FsYacc Include="CPar.fsy"> <OtherFlags>--module CPar</OtherFlags> </FsYacc> <FsLex Include="CLex.fsl"> <OtherFlags>--unicode</OtherFlags> </FsLex>
Add the rest of your files to the folder.
Include the files you just added to the
.csproj
file. Make sure to use the order that is used in the commands from the exercise.Example where order is like:
Absyn.fs CPar.fs CPar.fs...
fsharpi -r ~/fsharp/FsLexYacc.Runtime.dll Absyn.fs CPar.fs CLex.fs Parse.fs Machine.fs Comp.fs ParseAndComp.fs
Feel free to ignore the
.dll
as a NuGet package takes care of it.<Compile Include="Absyn.fs" /> <Compile Include="CPar.fs" /> <Compile Include="CLex.fs" /> <Compile Include="Parse.fs" /> <Compile Include="Machine.fs" /> <Compile Include="Comp.fs" /> <Compile Include="ParseAndComp.fs" />
Run
dotnet restore
anddotnet build
to make sure everything works.Now just run
dotnet build
every time you change your.fsy
and.fsl
files.You might sometimes need to delete the files
.fs
files that are generated by the build command.
Using .fsx
- Files with the
.fsx
extension are F# scripts that can be used to run code in the interactive terminal. - To load files you use
#load
. Make sure that you load all the files you need, in the order you added them in the.csproj
. - Just use the
.fsx
as you are used toIf you haven't used it before, then you can run a single line by having the cursor on it or run multiple lines by highlighting them, and then press
alt + enter
. - You don't need to use
;;
in this file like you do in the terminal.
-
net7.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.