Click to See Complete Forum and Search --> : grammar and regular expression


eidalina20
March 2nd, 2008, 12:08 AM
hey guys.. i am reading about grammar here and came across this statement.. can someone please help me answer a couple of questions based on this??

A regular expression over {0, 1} can be the empty string EMPTY, or the symbols 0, or 1. Additionally, if A and B are regular expressions, then so are A|B, A.B, (A) and A* with * having the highest precedence, followed by left-associative . followed by left-associative |. Parentheses can be used to override the default precedence.

1. can someone please give a grammar for the above regular expressions which enforces the associativity and precedecence of the above operators.


2. Based on the grammar from 1st part, give the parse tree for (0|1)*.0.


3. and this one: give a AST for (0|1)**.0.



thanks

Siddhartha
March 4th, 2008, 05:03 AM
[ redirected ]

Regards,
Siddhartha

karthik5591
September 29th, 2010, 06:50 PM
hii all
can any one post the answer of the above question???
thanks in advance

konrad.bojar
September 30th, 2010, 02:41 AM
I am 99% sure that this is a homework for one of entry-level computer science classes. We do not support criminal activity of cheating!

SunnySmile
September 30th, 2010, 05:32 PM
Right, this is a CS class homework. I finished college long ago enough for my brain to have no place for the syntax tree anymore. Hopefully someone working with these problems or those who just graduated from college and still memorize it will have an answer for you.

dglienna
October 7th, 2010, 01:19 PM
Try it out!