SCM Repository
[diderot] / trunk / src / parser / diderot.grm |
View of /trunk/src/parser/diderot.grm
Parent Directory
|
Revision Log
Revision 19 -
(download)
(annotate)
Fri Jan 15 14:17:29 2010 UTC (11 years, 1 month ago) by jhr
File size: 1541 byte(s)
Fri Jan 15 14:17:29 2010 UTC (11 years, 1 month ago) by jhr
File size: 1541 byte(s)
Working on Diderot grammar
(* diderot.grm * * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu) * All rights reserved. *) %name Diderot; %tokens : KW_actor ("actor") | KW_die ("die") | KW_field ("field") | KW_image ("image") | KW_new ("new") | KW_stabelize ("stabelize") | KW_eq ("=") | OP_orelse ("||") | OP_andalso ("&&") | OP_lt ("<") | OP_lte ("<=") | OP_eqeq ("==") | OP_neq ("!=") | OP_gte (">=") | OP_gt (">") | OP_plus ("+") | OP_minus ("-") | OP_star ("*") | OP_slash ("/") | OP_at ("@") | LP ("(") | RP (")") | LB ("[") | RB ("]") | LCB ("{") | RCB ("}") | INT of IntInf.int | FLOAT of FloatLit.float | STRING of string | ID of Atom.atom ; File : Decl+ ; Decl : ImageDecl | ValueDecl | FunDecl | ActorDecl ; ImageDecl : "image" ID ";" ; (***** Actors *****) ActorDecl : "actor" ID "(" Params ")" "{" ActorState* ActorMethod+ "}" ; Params : ( Param ( "," Param )* )? ; Param : Type ID ; ActorState : Type ID "=" Expr ";" ; ActorMethod : ID "{" "}" ; (***** Types *****) Type : "bool" | "int" | "real" ; (***** Expressions *****) Expr : Expr1 ( "||" Expr1 )* ; Expr1 : Expr2 ( "&&" Expr2 )* ; Expr2 : Expr3 ( CmpOp Expr3 )* ; CmpExp : "<" | "<=" | "==" | ">=" | ">" ; Expr3 : Expr4 ( AddOp Expr4 )* ; AddOp : "+" | "-" ; Expr4 : Expr5 ( MulOp Expr5 )* ; MulOp : "*" | "/" ; Expr5 : Expr6 ("@" Expr6)? ; AtomExp : ID | INT | FLOAT | STRING | "(" Expr ("," Expr)* ")" ;
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |