jmc
jmc

Reputation: 610

Top Down Recursive Parsing (simple examples)

In theoretical terms - not looking for specific implementation details, but how do I write a top-down recursive parser for a simple grammar example such as this:

 HAZ ::= FOO | BAR
 FOO ::= “tea” BAR | POT
 BAR ::= POT
 POT ::= “abc” FOO “tea"

Upvotes: 1

Views: 2178

Answers (1)

Ira Baxter
Ira Baxter

Reputation: 95362

See this answer for a general method for coding top down recursive descent parsers directly from a grammar:

Is there an alternative for flex/bison that is usable on 8-bit embedded systems?

Upvotes: 2

Related Questions