This commit is contained in:
Dmitry Boulytchev 2018-02-25 19:41:23 +03:00
commit 6bd9b1a5f5
2 changed files with 8 additions and 3 deletions

View file

@ -70,7 +70,12 @@ module Expr =
| Var x -> st x
| Binop (op, x, y) -> to_func op (eval st x) (eval st y)
(* Expression parser *)
(* Expression parser. You can use the following terminals:
IDENT --- a non-empty identifier a-zA-Z[a-zA-Z0-9_]* as a string
DECIMAL --- a decimal constant [0-9]+ as a string
*)
ostap (
parse:
!(Ostap.Util.expr
@ -93,7 +98,7 @@ module Expr =
| x:IDENT {Var x}
| -"(" parse -")"
)
end
(* Simple statements: syntax and sematics *)

View file

@ -16,7 +16,7 @@ type prg = insn list
(* The type for the stack machine configuration: a stack and a configuration from statement
interpreter
*)
type config = int list * Language.Stmt.config
type config = int list * Stmt.config
(* Stack machine interpreter