Ibraheem Osama Mohamed (ابراهيم اسامه محمد)

Welcome to my blog :)

Context Free Grammar(While-For-Regular Expressions https)

leave a comment »

CFG as I studied in the Compiler Course
While statement

For and While statement with compound statement

stmt-> for-stmt | assi-stmt | while-stmt | comp-stmt
comp-stmt->{ stmt-list}
stmt-list->stmt stmt-list | epsilon
while-stmt-> while(Cond) { stmt } | while(cond) stmt
for-stmt-> for(assi-stmt ; cond ; assi-stmt) { stmt } | for(assi-stmt;cond;assi-stmt) stmt
Cond-> id relop id | id relop digit | digit relop id
relop-> < || > | == | <= | >= | !=
assi-stmt-> id = expr ;
expr->expr + term | expr – term | term
term ->term*fact | term/Fact | fact
fact -> id | digit
id-> q|w|e|r|t|y|u|i|o|p|a|s|d|f|g|h|j|k|l|z|x|c|v|b|n|m|Q|W|E|R|T|Y|U|I|O|P|A|S|D|F|G|H|J|K|L|Z|X|C|V|B|N|M
digit -> 0|1|2|3|4|5|6|7|8|9

and CFG for simple https from regular expressions

https-stmt-> a:// domain-stmt.ext-stmt
domain-stmt -> a-zA-Z0-9\-\. | domain-stmt a-zA-Z0-9\-\.
a->https
ext-stmt-> com|org|net|mil|edu|COM|ORG|NET|MIL|EDU

Advertisements

Written by Ibraheem Osama Mohamed

June 24, 2012 at 10:50 pm

Posted in CFG

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

%d bloggers like this: