

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Jeffery von Ronne August 29, 2007
Top-level and variable declarations
PROG
Σ ` PROGRAM name BEGIN C END
(where name is any legal identifier)
DECLVAR
Σ | (→ _τ_ ) PROGRAM name D BEGIN C END Σ PROGRAM name VAR AS τ ; D BEGIN C END
SEQ
C 1 Σ C 2Statements
IF
Σ e : bool Σ C Σ ` IF e THEN C END ;
IFELSE
Σ e : bool Σ C 1 Σ C 2 Σ IF e THEN C 1 ELSE C 2 END ;
WHILE
Σ e : bool Σ C Σ ` WHILE e DO C END ;
ASGN
Σ : R( τ ) Σ e : _τ_ Σ ` := e
READINT
Σ : R(int) Σ := READINT ;
WRITEINT
Σ e : int Σ WRITEINT e;
Expressions and Operators
OP
Σ e 1 : int Σ e 2 : int Σ ` e 1 OP2 e 2 : int
OP
Σ e 1 : int Σ e 2 : int Σ ` e 1 OP3 e 2 : int
OP
Σ e 1 : int Σ e 2 : int Σ ` e 1 OP4 e 2 : bool
Variables and Literals
VARREF Σ | (→ _τ_ ) ` : R( τ ))
DEREF
Σ : R( τ ) ` : τ
INDEX
Σ : R(ARRAY ι OF INT) Σ e : int Σ ` [ e ] : R(int)
FALSE Σ ` FALSE : bool
TRUE Σ ` TRUE : bool
NUM Σ ` number : int
(where number is literal integer from -2147483648 through 2147483647)
C is a metavariable over sequences of zero or more statements (including the semicolons). D is a metavariable over sequences of zero or more variable declarations (in- cluding the last semicolon). e is metavariable over r-values. τ is a meta-variable over types. ι is some non-negative integer literal. R( τ ) is a type denoting a reference to a memory cell whose contents is of type τ. ` is some program variable name (name of a location in memory).