Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kam1986 opened this issue Apr 10, 2021 · 1 comment
Open

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

kam1986 opened this issue Apr 10, 2021 · 1 comment

Comments

@kam1986
Copy link

kam1986 commented Apr 10, 2021

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
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants