[parser] adding support for expressions
This commit is contained in:
32
src/ast.ml
32
src/ast.ml
@@ -2,12 +2,40 @@ type ident = string
|
||||
|
||||
type location = Lexing.position * Lexing.position
|
||||
|
||||
type const =
|
||||
| CBool of bool
|
||||
| CInt of int
|
||||
|
||||
type monop =
|
||||
| MOp_not
|
||||
| MOp_minus
|
||||
|
||||
type binop =
|
||||
| BOp_add | BOp_sub | BOp_mul | BOp_div | BOp_mod
|
||||
| BOp_and | BOp_or | BOp_eq | BOp_neq
|
||||
| BOp_le | BOp_lt | BOp_ge | BOp_gt
|
||||
|
||||
type triop =
|
||||
| TOp_if
|
||||
|
||||
type base_ty =
|
||||
| Tbool
|
||||
| Tint
|
||||
|
||||
type p_pattern = string
|
||||
and p_expression = string
|
||||
type p_pattern =
|
||||
| PP_var of ident
|
||||
| PP_tuple of ident list
|
||||
|
||||
type p_expression =
|
||||
| PE_Const of const
|
||||
| PE_Var of ident
|
||||
| PE_MonOp of monop * p_expression
|
||||
| PE_BinOp of binop * p_expression * p_expression
|
||||
| PE_TriOp of triop * p_expression * p_expression * p_expression
|
||||
| PE_app of ident * p_expression list
|
||||
| PE_tuple of p_expression list
|
||||
| PE_pre of p_expression
|
||||
| PE_arrow of p_expression * p_expression
|
||||
|
||||
type p_equation =
|
||||
{ peq_patt: p_pattern;
|
||||
|
||||
Reference in New Issue
Block a user