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 annotation 'end since it is a keyword..
but I'm in first place just copy pasting the dummi files from the page to make sure the makefile are up and running. (lexer, parser, and program)
page: https://fsprojects.github.io/FsLexYacc/index.html
I then get the
../../FSharp/Project/src/Lexer.fsl(21,81): error FS0001: The type 'char' does not match the type 'byte'
Have tried to enforce the type by changing _ to byte that didn't help at all
Makefile:
OS=$(shell uname -s)
ifeq ($(OS),Darwin)
export AS=as -arch i386
export CC=cc -arch i386 -framework CoreFoundation -lobjc -liconv
endif
.PHONY: all clean
fsl = fslex
fsp = fsyacc
fsc = fsharpc --nologo
fsyacclib = FsLexYacc.10.2.0/build/fsyacc/netcoreapp3.1/FsLexYacc.Runtime.dll
Main = bin/Main.exe
LexerGen = src/Lexer.fs
ParserGen = src/Parser.fs
Lexer = bin/Lexer.dll
Parser = bin/Parser.dll
all: $(Main)
$(LexerGen): src/Lexer.fsl
$(fsl) src/Lexer.fsl -o $(LexerGen)
$(ParserGen): src/Parser.fsy
$(fsp) -v --module Parser src/Parser.fsy -o $(ParserGen)
$(Lexer): $(LexerGen) $(Parser)
$(fsc) -a $(LexerGen) -r $(Parser) -o $(Lexer)
$(Parser): $(ParserGen) $(Regex) $(fsyacclib)
$(fsc) -a $(ParserGen) -r $(Regex) -r $(fsyacclib) -o $(Parser)
$(Main): src/Main.fsx $(Lexer) $(Parser)
$(fsc) -a src/Main.fsx -r $(fsyacclib) -r $(Lexer) -r $(Parser) -o $(Main)
clean: rm /bin/*.dll
I tried this, but I was not able to reproduce your error. Here is what I'm doing. Is there something I'm doing differently than you?
I copied the
Lexer.fsl
file from the repository:And the
Parser.fsy
file:And run the following command to compile the two:
The source code in the generated
Lexer.fs
looks something like this: