Pointless Semantics: As you might guess Pointless contains no pointers. Uses copy semantics. i.e. - copy variables when passed into/returned from a function - copy variables on assign Functions and types are globally scoped, there are no nested functions. You do not need to worry about what the keyword pure means until we begin optimizations --------------------------------------------------------------------------- Pointless Syntax ---------------- Syntax taken from Javacc: (x) - grouping [x] - x is optional x* - any number of x's x+ - at least one x < > - specifying lexical tokens // represent single line comments. /* */ represent multi-line comments. Program: (Function | Record | GlobalDecl)* Function: ["pure"] "function" Id "(" [DeclList] ")" [":" TypeId] BlockStatement Record: "record" TypeId { (Decl;)* } Statement: BlockStatement | Decl ; | ReturnStatement ; | IfStatement | ForStatement | WhileStatement | AssignStatement; | ; | DispatchExpr ; ReturnStatement: "return" Expr IfStatement: "if" IfClause ("else_if" IfClause)* [ElseClause] "fi" IfClause: Expr "then" Statement ElseClause: "else" Statement ForStatement: "for" VarExpr "=" Expr "to" Expr "do" Statement WhileStatement: "while" Expr "do" Statement AssignStatement: RefExpr := Expr BlockStatement : "{" Statement* "}" Expr: BinaryExpr| UnaryExpr ExprList: Expr (, Expr)* UnaryExpr: "(" Expr ")"| DispatchExpr| IntConst| BoolConst| StringConst| RefExpr| UnaryMinus UnaryMinus: "-" Expr DispatchExpr: Id "(" [ExprList] ")" RefExpr: (ArrayRefExpr|VarExpr) (. RefExpr)* VarExpr: Id ArrayRefExpr: Id "[" Expr "]" IntConst: number BoolConst: "true" | "false" //not correct syntax, changed for readability (yes -- I know it isn't very //readable the original form is even worse!) StringConst: "\"" ("\\\""| [" " - "!", "#" - "~"])* "\"" /* parsing of Binary Expr's left as an exercise */ BinaryExpr: Expr Infix Expr /* Where infix is left-associative and there are three levels of associativity, grouped from lowest to highest precedence, below */ Infix = (<,>,=) (+,-) (*,/) /* end infix specification */ DeclList: Decl (,Decl)* Decl: TypeDecl Id //By popular demand (most people's testing programs had them, a semi-colon ends //GlobalDecl. GlobalDecl: TypeDecl Id ";" TypeDecl: TypeId [ number ] | TypeId //This is not the exact Java sytax, just a readable representation of it. number: <0-9>+ Id: * TypeId: * BoolOp: < ">", "<", "="> PlusOp: <"+","-"> TimesOp: <"*","/">