diff --git a/doc/ast.txt b/doc/ast.txt new file mode 100755 index 0000000..72958b3 --- /dev/null +++ b/doc/ast.txt @@ -0,0 +1,55 @@ +############################################################################## + ABSTRACT SYNTAX +############################################################################## + +P = Program { D } E + +D = ClassDef name [ name ] { M } +# where [ name ] corresponds to [ "extends" ident ] in the concrete syntax + +M = FieldDecl name T + | MethodDef name { name T } T E +# where { name T } corresponds to [ Formal { "," Formal } ] in the con. syntax + +T = ClassType name + | IntType + | NullType + +S = While E { S } + | Var name T E + | Set name E + | Do E + | PrintInt E + | PrintChar E + +E = Ident name + | New name { E } + | Select E name + | Call E name { E } + | IntLit int + | NullLit + | Unop U E + | Binop B E E + | ReadInt + | ReadChar + | If E E E + | Block { S } E + +U = Not + | Neg + +B = Add + | Sub + | Mul + | Div + | Mod + | Eq + | Ne + | Lt + | Le + | Gt + | Ge + | And + +############################################################################## +$Id$