user1968057
user1968057

Reputation: 59

ocaml parser and lexer

Hi I have the 3 files nano.ml which is the type, and a paser and lexer file. I have no idea how to write the rules for parser, and i try to write the rules but it gives me erro saying that does not accept argument.
when i try to compile it gives me this

:File "nanoParse.mly", line 31: $1 refers to terminal `LET', which has no argument
Compiling (to byte code) OCAML module nanoLex.ml
ocamlc -dtypes -c nanoLex.ml -o nanoLex.cmo
File "nanoLex.mll", line 10, characters 32-37:
Error: The constructor LET expects 1 argument(s),
but is here applied to 0 argument(s)

and the program suppose to do something like this:

Upvotes: 1

Views: 1274

Answers (1)

Jeffrey Scofield
Jeffrey Scofield

Reputation: 66823

I suspect you want {Let($2, $3, $5)} instead of {Let($1, $2, $3)}. However, this is a lot of code to look through. You might want to start with a tiny example and work up from there.

Upvotes: 1

Related Questions