SCM Repository
[diderot] / trunk / src / parser / diderot.grm |
View of /trunk/src/parser/diderot.grm
Parent Directory
|
Revision Log
Revision 23 -
(download)
(annotate)
Mon Feb 1 03:29:06 2010 UTC (12 years, 5 months ago) by jhr
File size: 1867 byte(s)
Mon Feb 1 03:29:06 2010 UTC (12 years, 5 months ago) by jhr
File size: 1867 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 : InputDecl | GlobalDecl | ActorDecl ; (***** Inputs *****) InputDecl : "input" Type ID ( "=" Expr )? ";" ; (***** Global declarations *****) GlobalDecl : Type ID "=" Expr ";" ; (***** Actors *****) ActorDecl : "actor" ID "(" Params ")" "{" ActorState* ActorMethod+ "}" ; Params : ( Param ( "," Param )* )? ; Param : Type ID ; ActorState : Type ID "=" Expr ";" ; ActorMethod : ID "{" "}" ; (***** Types *****) Type : "image" "<" Dimension "," Dimension ">" | "tensor" "<" Dimension "," Dimension ">" | "field" "#" Dimension "<" Dimension "," Dimension ">" | "kernel" "#" Dimension | "vec" "<" Dimension ">" | "bool" | "int" | "real" ; Dimension : POSINT ; (***** 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 |