Checking Grammar
Written on Monday, May 05, 2008 by Ennah, the comsci student
My 2nd Machine Problem. Similar to the 1st Machine Problem. Again in VB.NET
Input: An assignment sentence
(see ambiguous grammar for simple assignment sentence)
assign --> id = expr
id --> A | B | C
expr --> expr + expr | expr *expr |(expr) | id
Output:
"Syntax error" if the grammar is incorrect
or
"Valid" if the grammar is correct.
Example.
A = B + C * B
Valid
B = A * (C + B)
Valid
A = A+C * B+
Syntax error
Screenshots: