I am new to OCaml and I am trying to create a Parser for a specific language using a parser generator - ocamllex, ocamlyacc. When i'm trying to compile my parser.mly file, I am getting the following error:
Error (with mark at =) :
File "parser.mly", line 94: unterminated action
| id = IDENTIFIER { identifier id }
;
The following is an extract from the parser.mly file:
%{
open Ast
let identifier name = {
Identifier.name = name;
}
%}
%token <int> INT
%token <string> IDENTIFIER
%start monitor
%type <Ast.Expression.t> monitor
%%
ident:
| id = IDENTIFIER { identifier id }
;
Ocamlyacc does not support giving names to the parts of a rule like this. You'll either need to use $1
etc. or switch to Menhir, which does support this feature.