| 123456789101112131415161718192021222324252627282930 |
- %{
- open Lexing
- open Types
- %}
- (* tokens *)
- %token SEMICOL EXCLAM PLUS MINUS OMEGA LPAREN RPAREN HASH
- %token <int> NUMBER
- %token <char> UPPER LOWER
- %token EOF
- (* start symbol *)
- %type <Types.program> program
- %start program
- %%
- program:
- | instrs=separated_list(SEMICOL, instruction) EOF
- { instrs }
- instruction:
- | c=LOWER { Basic c }
- | EXCLAM { Terminate }
- | PLUS c=LOWER { Ptest c }
- | MINUS c=LOWER { Ntest c }
- | HASH n=NUMBER { Jump n }
- | i=instruction OMEGA { Repeat i }
- | c=UPPER { Program c }
- | LPAREN i=separated_list(SEMICOL, instruction) RPAREN { Concat i }
|