Posted by: sirivy | March 27, 2009

Grammar Beta Version

Program_list –> Program_list Program
Program_list –> Program
Program –> Declare; | Assign; | Condition | Loop
Declare –> Type variable | Type variable = exp
Variable –> id | Array
Array –> Array_size]
Array_size –> id [size
Type –> int | float | char | string
Assign –> Statement
Statement –> id = expression
Statement –> expression
expression –> expression + term | expression – term | term
term –> term * fac | term / fac | factor
factor –> (expression)
factor –> -factor | id | number | char | string
Control –> If_cond; | If_else_cond;
If_cond; –> if(condition) command
If_else_cond; –> if(condition) command else command
condition –> sub_cond; m_op subcondition | p_op subcondtion | sub_condition
m_op –> and|or
p_op –> not
sub_condi –> (sub_condition) | DATA relop DATA
sub_condi –> true | false
DATA –> id | expression | number | char | string
command –> Program | { Program }

Loop –> while_Loop | for_Loop
while_Loop –> while (condition) command
For_Loop –> For(Declare ; condition; Assign ) command


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: