786b183d40
* Reverted [pos.mli] to the previous signature, except [Pos.min] that now takes a labelled parameter [file]. * Reverted [ParserAPI.ml] to the previous signature. * Reexported [shor_error] in [ParserUnit]. * Changed the modules [LexToken] so that they export one function to make attributes, the first, additional paramater being "[@" or "[@@" (and invalid in PascaLIGO). * Added support in all [ParserLog] for attributes (pretty-printings). * Added AST nodes [Attr] and [AttrDecl] to PascaLIGO. The simplifier takes care of hooking them with their respective declarations or discarding them. (In the future, we should issue a warning for detached attributes.)
85 lines
2.1 KiB
OCaml
85 lines
2.1 KiB
OCaml
%{
|
|
%}
|
|
|
|
(* Tokens (mirroring thise defined in module LexToken) *)
|
|
|
|
(* Literals *)
|
|
|
|
%token <string Region.reg> String "<string>"
|
|
%token <(LexToken.lexeme * Hex.t) Region.reg> Bytes "<bytes>"
|
|
%token <(string * Z.t) Region.reg> Int "<int>"
|
|
%token <(string * Z.t) Region.reg> Nat "<nat>"
|
|
%token <(string * Z.t) Region.reg> Mutez "<mutez>"
|
|
%token <string Region.reg> Ident "<ident>"
|
|
%token <string Region.reg> Constr "<constr>"
|
|
%token <string Region.reg> Attr "<attr>"
|
|
|
|
(* Symbols *)
|
|
|
|
%token <Region.t> MINUS "-"
|
|
%token <Region.t> PLUS "+"
|
|
%token <Region.t> SLASH "/"
|
|
%token <Region.t> TIMES "*"
|
|
|
|
%token <Region.t> LPAR "("
|
|
%token <Region.t> RPAR ")"
|
|
%token <Region.t> LBRACKET "["
|
|
%token <Region.t> RBRACKET "]"
|
|
%token <Region.t> LBRACE "{"
|
|
%token <Region.t> RBRACE "}"
|
|
|
|
%token <Region.t> ARROW "->"
|
|
%token <Region.t> CONS "::"
|
|
%token <Region.t> CAT "^"
|
|
(*%token <Region.t> APPEND "@" *)
|
|
%token <Region.t> DOT "."
|
|
|
|
%token <Region.t> COMMA ","
|
|
%token <Region.t> SEMI ";"
|
|
%token <Region.t> COLON ":"
|
|
%token <Region.t> VBAR "|"
|
|
|
|
%token <Region.t> WILD "_"
|
|
|
|
%token <Region.t> EQ "="
|
|
%token <Region.t> NE "<>"
|
|
%token <Region.t> LT "<"
|
|
%token <Region.t> GT ">"
|
|
%token <Region.t> LE "<="
|
|
%token <Region.t> GE ">="
|
|
|
|
%token <Region.t> BOOL_OR "||"
|
|
%token <Region.t> BOOL_AND "&&"
|
|
|
|
(* Keywords *)
|
|
|
|
(*%token And*)
|
|
%token <Region.t> Begin "begin"
|
|
%token <Region.t> Else "else"
|
|
%token <Region.t> End "end"
|
|
%token <Region.t> False "false"
|
|
%token <Region.t> Fun "fun"
|
|
%token <Region.t> If "if"
|
|
%token <Region.t> In "in"
|
|
%token <Region.t> Let "let"
|
|
%token <Region.t> Match "match"
|
|
%token <Region.t> Mod "mod"
|
|
%token <Region.t> Not "not"
|
|
%token <Region.t> Of "of"
|
|
%token <Region.t> Or "or"
|
|
%token <Region.t> Then "then"
|
|
%token <Region.t> True "true"
|
|
%token <Region.t> Type "type"
|
|
%token <Region.t> With "with"
|
|
|
|
(* Data constructors *)
|
|
|
|
%token <Region.t> C_None "None"
|
|
%token <Region.t> C_Some "Some"
|
|
|
|
(* Virtual tokens *)
|
|
|
|
%token <Region.t> EOF
|
|
|
|
%%
|