fsprojects / FsLexYacc

Lexer and parser generators for F#
http://fsprojects.github.io/FsLexYacc/
MIT License
203 stars 68 forks source link

Can't find the FSharp.Text.Lexing and FSharp.Text.Parsing lib? #148

Open kam1986 opened 3 years ago

kam1986 commented 3 years ago

Hey I'm currently trying to compile the example code om my Linux (Manjaro)

I have altered the 'end' in the .fsy file since this coursed a rejection at compile time because it is a keyword.

I then try to compile the code once more. it then give a lot of error messages back, but the two I think are the root of the rest, is that it can't find FSharp.Text.Lexing and FSharp.Text.Parsing

/../Parser.fs(4,18): error FS0039: The namespace 'Lexing' is not defined.

/../Parser.fs(5,18): error FS0039: The namespace 'Parsing' is not defined.

/../Parser.fs(80,40): error FS0039: The type 'Parsing' is not defined.

My MakeFile looks like this

.PHONY: all clean

fsl = fslex fsp = fsyacc fsc = fsharpc --nologo

Program = Program.exe LexerGen = Lexer.fs ParserGen = Parser.fs

Parser = Parser.dll Lexer = Lexer.dll

all: $(Program)

$(LexerGen): Lexer.fsl $(fsl) Lexer.fsl -o $(LexerGen)

$(ParserGen): Parser.fsy $(fsp) -v --module Parser Parser.fsy -o $(ParserGen)

$(Lexer): $(LexerGen) $(Parser) $(fsc) -a $(LexerGen) -r $(Parser) -o $(Lexer)

$(Parser): $(ParserGen) $(fsc) -a $(ParserGen) -o $(Parser)

$(Program): Program.fsx $(Parser) $(Lexer) $(fsc) Program.fsx -r $(Lexer) -r $(Parser) -o $(Program)

and the code are the same as in the lexer, parser and program given on this site

teo-tsirpanis commented 3 years ago

Hello, is there a particular reason why you use Makefiles? Building code in .NET is a much more complex process than simply calling the language's compiler, and doing it with make is an unsupported and extremely unusual and counterproductive occurrence.

How to fix the issue? Create an F# project either with Visual Studio or the dotnet CLI tool, and install the FsLexYacc and FsLexYacc.Runtime NuGet packages. In your Makefile you call the compiler once for the parser and once for the lexer, but it would be much easier for you if they were on the same project.

Let me know if anything went well.