2019-02-26 01:29:29 +04:00
|
|
|
%{
|
|
|
|
%}
|
|
|
|
|
|
|
|
(* Tokens (mirroring thise defined in module LexToken) *)
|
|
|
|
|
|
|
|
(* Literals *)
|
|
|
|
|
2019-03-20 19:31:33 +04:00
|
|
|
%token <LexToken.lexeme Region.reg> String
|
|
|
|
%token <(LexToken.lexeme * Hex.t) Region.reg> Bytes
|
|
|
|
%token <(LexToken.lexeme * Z.t) Region.reg> Int
|
|
|
|
%token <LexToken.lexeme Region.reg> Ident
|
|
|
|
%token <LexToken.lexeme Region.reg> Constr
|
2019-02-26 01:29:29 +04:00
|
|
|
|
|
|
|
(* Symbols *)
|
|
|
|
|
2019-02-28 18:46:34 +04:00
|
|
|
%token <Region.t> SEMI (* ";" *)
|
|
|
|
%token <Region.t> COMMA (* "," *)
|
|
|
|
%token <Region.t> LPAR (* "(" *)
|
|
|
|
%token <Region.t> RPAR (* ")" *)
|
2019-03-25 19:38:07 +04:00
|
|
|
%token <Region.t> LBRACE (* "{" *)
|
|
|
|
%token <Region.t> RBRACE (* "}" *)
|
2019-02-28 18:46:34 +04:00
|
|
|
%token <Region.t> LBRACKET (* "[" *)
|
|
|
|
%token <Region.t> RBRACKET (* "]" *)
|
2019-03-10 22:41:27 +04:00
|
|
|
%token <Region.t> CONS (* "#" *)
|
2019-02-28 18:46:34 +04:00
|
|
|
%token <Region.t> VBAR (* "|" *)
|
|
|
|
%token <Region.t> ARROW (* "->" *)
|
2019-03-07 20:06:02 +04:00
|
|
|
%token <Region.t> ASS (* ":=" *)
|
2019-02-28 18:46:34 +04:00
|
|
|
%token <Region.t> EQUAL (* "=" *)
|
|
|
|
%token <Region.t> COLON (* ":" *)
|
|
|
|
%token <Region.t> LT (* "<" *)
|
|
|
|
%token <Region.t> LEQ (* "<=" *)
|
|
|
|
%token <Region.t> GT (* ">" *)
|
|
|
|
%token <Region.t> GEQ (* ">=" *)
|
|
|
|
%token <Region.t> NEQ (* "=/=" *)
|
|
|
|
%token <Region.t> PLUS (* "+" *)
|
|
|
|
%token <Region.t> MINUS (* "-" *)
|
|
|
|
%token <Region.t> SLASH (* "/" *)
|
|
|
|
%token <Region.t> TIMES (* "*" *)
|
|
|
|
%token <Region.t> DOT (* "." *)
|
|
|
|
%token <Region.t> WILD (* "_" *)
|
|
|
|
%token <Region.t> CAT (* "^" *)
|
2019-02-26 01:29:29 +04:00
|
|
|
|
|
|
|
(* Keywords *)
|
|
|
|
|
2019-03-20 15:28:25 +04:00
|
|
|
%token <Region.t> And (* "and" *)
|
2019-02-28 18:46:34 +04:00
|
|
|
%token <Region.t> Begin (* "begin" *)
|
2019-03-25 19:38:07 +04:00
|
|
|
%token <Region.t> Block (* "block" *)
|
2019-03-19 14:46:30 +04:00
|
|
|
%token <Region.t> Case (* "case" *)
|
2019-02-28 18:46:34 +04:00
|
|
|
%token <Region.t> Const (* "const" *)
|
2019-03-22 02:45:19 +04:00
|
|
|
%token <Region.t> Contains (* "contains" *)
|
2019-02-28 18:46:34 +04:00
|
|
|
%token <Region.t> Down (* "down" *)
|
2019-03-26 13:31:55 +04:00
|
|
|
%token <Region.t> Else (* "else" *)
|
|
|
|
%token <Region.t> End (* "end" *)
|
|
|
|
%token <Region.t> Entrypoint (* "entrypoint" *)
|
2019-02-28 18:46:34 +04:00
|
|
|
%token <Region.t> Fail (* "fail" *)
|
2019-03-26 13:31:55 +04:00
|
|
|
%token <Region.t> For (* "for" *)
|
|
|
|
%token <Region.t> Function (* "function" *)
|
2019-03-22 00:55:59 +04:00
|
|
|
%token <Region.t> From (* "from" *)
|
2019-02-28 18:46:34 +04:00
|
|
|
%token <Region.t> If (* "if" *)
|
|
|
|
%token <Region.t> In (* "in" *)
|
|
|
|
%token <Region.t> Is (* "is" *)
|
2019-03-26 13:31:55 +04:00
|
|
|
%token <Region.t> List (* "list" *)
|
|
|
|
%token <Region.t> Map (* "map" *)
|
|
|
|
%token <Region.t> Mod (* "mod" *)
|
|
|
|
%token <Region.t> Nil (* "nil" *)
|
|
|
|
%token <Region.t> Not (* "not" *)
|
2019-02-28 18:46:34 +04:00
|
|
|
%token <Region.t> Of (* "of" *)
|
2019-03-20 15:28:25 +04:00
|
|
|
%token <Region.t> Or (* "or" *)
|
2019-03-19 17:32:43 +04:00
|
|
|
%token <Region.t> Patch (* "patch" *)
|
2019-02-28 18:46:34 +04:00
|
|
|
%token <Region.t> Procedure (* "procedure" *)
|
|
|
|
%token <Region.t> Record (* "record" *)
|
2019-03-22 00:55:59 +04:00
|
|
|
%token <Region.t> Remove (* "remove" *)
|
2019-03-22 01:55:08 +04:00
|
|
|
%token <Region.t> Set (* "set" *)
|
2019-03-18 21:09:15 +04:00
|
|
|
%token <Region.t> Skip (* "skip" *)
|
2019-02-28 18:46:34 +04:00
|
|
|
%token <Region.t> Step (* "step" *)
|
2019-03-14 21:17:19 +04:00
|
|
|
%token <Region.t> Storage (* "storage" *)
|
2019-03-26 13:31:55 +04:00
|
|
|
%token <Region.t> Then (* "then" *)
|
2019-02-28 18:46:34 +04:00
|
|
|
%token <Region.t> To (* "to" *)
|
2019-03-26 13:31:55 +04:00
|
|
|
%token <Region.t> Type (* "type" *)
|
|
|
|
%token <Region.t> Var (* "var" *)
|
2019-02-28 18:46:34 +04:00
|
|
|
%token <Region.t> While (* "while" *)
|
|
|
|
%token <Region.t> With (* "with" *)
|
2019-02-26 01:29:29 +04:00
|
|
|
|
|
|
|
(* Data constructors *)
|
|
|
|
|
2019-02-28 18:46:34 +04:00
|
|
|
%token <Region.t> C_False (* "False" *)
|
|
|
|
%token <Region.t> C_None (* "None" *)
|
|
|
|
%token <Region.t> C_Some (* "Some" *)
|
|
|
|
%token <Region.t> C_True (* "True" *)
|
|
|
|
%token <Region.t> C_Unit (* "Unit" *)
|
2019-02-26 01:29:29 +04:00
|
|
|
|
|
|
|
(* Virtual tokens *)
|
|
|
|
|
|
|
|
%token <Region.t> EOF
|
|
|
|
|
|
|
|
%%
|