25 lines
442 B
OCaml
25 lines
442 B
OCaml
%{
|
|
open Be_ast
|
|
%}
|
|
|
|
%token <string> ADDRESS
|
|
%token <string> COMMAND
|
|
%token <string> SEGMENT
|
|
%token <string> COMMENT
|
|
%token EOF
|
|
|
|
%start <Be_ast.expr> prog
|
|
|
|
%%
|
|
|
|
prog:
|
|
| e = expr; EOF { e }
|
|
;
|
|
|
|
expr:
|
|
| c = COMMENT { Comment c }
|
|
| c = COMMAND; { Acommand c }
|
|
| c = COMMAND; s = SEGMENT; a = ADDRESS { Mcommand (c, s, a) }
|
|
| e = expr; COMMENT { e }
|
|
;
|