Grammar/ Parser questions?
I just coded a recursive decent parser for my compiler class however, I think my grammer needs a little help. This is the grammar used:
s --> [ A S ] | ( B ) S | Nothing
A --> A#A | a
B --> ?S, | .S | b
Terminals are [ ] ( ) # ? , .
I figured out that I have to get rid of the left recursion where A is defined and I've discovered the re-write rule to get rid of it. However, the examples I have are pretty trivial.
This is what I think the new correct grammar should be:
S --> [ A S ] | ( B ) S | Nothing
A --> aT
T --> #AT | Nothing
B --> ?S, | .S | b
Do this grammer look correct to you? Thanks for any tips or suggestions!
|