Step by step guide to getting FsYacc and FsLex for development on OS X.
By doing one of these:
- Recommended1: Via mono-project.com
- With homebrew (in the terminal):
brew install mono
Download nuget.exe to ~/fsharp
.
Copy paste into a terminal:
cd ~/fsharp # move to the ~/fsharp directory
mono nuget.exe install FsLexYacc # install fslexyacc with nuget
ls # list which files are in the current directory
# Should output something like:
# FsLexYacc.6.1.0/ FsLexYacc.Runtime.6.1.0/ nuget.exe
Copy paste into a terminal:
cd /usr/local/bin
echo -e '#!/bin/bash\nmono /Users/'$USER'/fsharp/FsLexYacc.6.1.0/build/fslex.exe $*' > fslex
echo -e '#!/bin/bash\nmono /Users/'$USER'/fsharp/FsLexYacc.6.1.0/build/fsyacc.exe $*' > fsyacc
chmod a+x fslex fsyacc
The FsLexYacc.Runtime.dll
file needs to be referred to when lexing
and compiling your language,
# link the Runtime to your ~/fsharp folder (once):
ln -s ~/fsharp/FsLexYacc.Runtime.6.1.0/lib/net40/FsLexYacc.Runtime.dll ~/fsharp
# then henceforth, you can use the following from your project directory
# (referring to the link you just made):
fsharpi -r ~/fsharp/FsLexYacc.Runtime.dll Absyn.fs FunPar.fs FunLex.fs Parse.fs
You should now totally have FsLexYacc on your OS X computer, ready to create awesome languages and compilers!
- When building from Homebrew, the Mono runtime gets odd parameters which sets tail-call optimizations to disabled for some reason, avoid this by using the downloadable installer from mono-project.
Is this guide still valid? When running
fsharpi -r ~/fsharp/FsLexYacc.Runtime.dll Absyn.fs FunPar.fs FunLex.fs Parse.fs
I getCould not find file "/Users/europa/fsharp/FsLexYacc.Runtime.dll"
, but checking the folder, the file is there.