Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/lamont/src/compiler/parser/diderot.grm
ViewVC logotype

Diff of /branches/lamont/src/compiler/parser/diderot.grm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2082, Tue Nov 6 22:54:10 2012 UTC revision 2083, Thu Nov 8 18:42:05 2012 UTC
# Line 14  Line 14 
14    | KW_field            ("field")    | KW_field            ("field")
15    | KW_identity         ("identity")    (* identity matrix *)    | KW_identity         ("identity")    (* identity matrix *)
16    | KW_if               ("if")    | KW_if               ("if")
17      | KW_foreach      ("foreach")
18    | KW_image            ("image")    | KW_image            ("image")
19    | KW_input            ("input")    | KW_input            ("input")
20    | KW_in               ("in")    | KW_in               ("in")
# Line 22  Line 23 
23    | KW_kernel           ("kernel")    | KW_kernel           ("kernel")
24    | KW_load             ("load")    | KW_load             ("load")
25    | KW_new              ("new")    | KW_new              ("new")
26      | KW_sphere   ("sphere")
27    | KW_output           ("output")    | KW_output           ("output")
28    | KW_print            ("print")    | KW_print            ("print")
29    | KW_real             ("real")    | KW_real             ("real")
# Line 53  Line 55 
55    | OP_star             ("*")    | OP_star             ("*")
56    | OP_convolve         ("⊛")    | OP_convolve         ("⊛")
57    | OP_dot              ("•")    | OP_dot              ("•")
58      | OP_dotSelect (".")
59    | OP_cross            ("×")    | OP_cross            ("×")
60    | OP_outer            ("⊗")    | OP_outer            ("⊗")
61    | OP_slash            ("/")    | OP_slash            ("/")
# Line 83  Line 86 
86    
87  %keywords  %keywords
88    KW_bool, KW_die, KW_else, KW_field, KW_identity, KW_if, KW_image, KW_initially,    KW_bool, KW_die, KW_else, KW_field, KW_identity, KW_if, KW_image, KW_initially,
89    KW_int, KW_kernel, KW_load, KW_new, KW_output, KW_print, KW_real, KW_stabilize,    KW_foreach, KW_int, KW_kernel, KW_load, KW_new, KW_output, KW_print,KW_sphere, KW_real, KW_stabilize,
90    KW_strand, KW_string, KW_tensor, KW_update, KW_vec2, KW_vec3, KW_vec4, KW_zeros;    KW_strand, KW_string, KW_tensor, KW_update, KW_vec2, KW_vec3, KW_vec4, KW_zeros;
91    
92  %defs (  %defs (
# Line 151  Line 154 
154    
155  (***** variable declarations *****)  (***** variable declarations *****)
156    
157    VarIterationDecl
158        : Type ID "in" Expr
159            => (mark PT.VD_Mark (FULL_SPAN, PT.VD_Decl(Type, ID, Expr)))
160        ;
161  VarDecl  VarDecl
162          : Type ID "=" Expr ";"          : Type ID "=" Expr ";"
163                  => (mark PT.VD_Mark (FULL_SPAN, PT.VD_Decl(Type, ID, Expr)))                  => (mark PT.VD_Mark (FULL_SPAN, PT.VD_Decl(Type, ID, Expr)))
# Line 202  Line 209 
209  Stmt  Stmt
210          : AtomicStmt          : AtomicStmt
211                  => (AtomicStmt)                  => (AtomicStmt)
212            | %try  "foreach" "(" VarIterationDecl ")" Stmt
213                => (markStmt(FULL_SPAN, PT.S_Foreach(VarIterationDecl,Stmt)))
214          | %try "if" "(" Expr ")" Stmt "else" Stmt          | %try "if" "(" Expr ")" Stmt "else" Stmt
215                  => (markStmt(FULL_SPAN, PT.S_IfThenElse(Expr, Stmt1, Stmt2)))                  => (markStmt(FULL_SPAN, PT.S_IfThenElse(Expr, Stmt1, Stmt2)))
216          | %try "if" "(" Expr ")" Stmt          | %try "if" "(" Expr ")" Stmt
# Line 324  Line 333 
333                  => (markTy(FULL_SPAN, PT.T_Real))                  => (markTy(FULL_SPAN, PT.T_Real))
334          | "string"          | "string"
335                  => (markTy(FULL_SPAN, PT.T_String))                  => (markTy(FULL_SPAN, PT.T_String))
336        | ID
337            => (markTy(FULL_SPAN, PT.T_Strand ID))
338          ;          ;
339    
340  Dimensions  Dimensions
# Line 414  Line 425 
425                  => (fn e => markExpr(FULL_SPAN, PT.E_Apply(e, Arguments)))                  => (fn e => markExpr(FULL_SPAN, PT.E_Apply(e, Arguments)))
426          | "[" Indices "]"          | "[" Indices "]"
427                  => (fn e => PT.E_Slice(e, Indices))                  => (fn e => PT.E_Slice(e, Indices))
428        |  "." ID
429            => (fn e => PT.E_Selector(e,ID))
430          | "{" Expr "}"          | "{" Expr "}"
431                  => (fn e => PT.E_Subscript(e, Expr))                  => (fn e => PT.E_Subscript(e, Expr))
432          ;          ;
# Line 450  Line 463 
463                  => (markExpr(FULL_SPAN, PT.E_Id Dimension))                  => (markExpr(FULL_SPAN, PT.E_Id Dimension))
464          | KW_zeros Dimensions          | KW_zeros Dimensions
465                  => (markExpr(FULL_SPAN, PT.E_Zero Dimensions))                  => (markExpr(FULL_SPAN, PT.E_Zero Dimensions))
466        | KW_sphere "(" Expr ")"
467            => (markExpr(FULL_SPAN, PT.E_SphereQuery(Expr)))
468  (* should the following be classified as SuffixExprs? *)  (* should the following be classified as SuffixExprs? *)
469          | "real" "(" Expr ")"          | "real" "(" Expr ")"
470                  => (markExpr(FULL_SPAN, PT.E_Real Expr))                  => (markExpr(FULL_SPAN, PT.E_Real Expr))

Legend:
Removed from v.2082  
changed lines
  Added in v.2083

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0