All along, with the recursive descent parsing method, the left-recursive 
grammar is bad deal to hoe, as it will easily lead to infinite recursive 
call to function. For this reason, and now the mainstream parsers usually 
use the LR method,  with some tools such as lex / yacc, bison and the like, 
to generate parsers. Although some of languages adopt recursive descent 
parsing method, which had to limit their syntactic constructs, or make 
grammatical rule system unnecessarily complicated.

Last night, I finally found a simple and elegant way to process left 
recursive rules with the recursive descent method. After trying and failing 
for thirties or forties times in nearly five years, I get a beautiful 
result at last. I feel it's very cool. I experience the pleasure of success 
with persevere once again .

This method has the following features:
1. It can handle left recursion, including indirect left recursion.
2. It is simple and intuitive, the code of parser will be very readable.
3. It can achieve the same time complexity of O(n) as LL(k), LR method on 
proper grammar.
4 It is space-efficient. With this method, no transform table is needed, 
which is used in LR method. It do not need memo on every grammar symbol is 
need, which is usually adopted in peg/packrat parser. Instead, It only need 
memorize left recusive grammar symbol.
5. easy to learn, easy to use. the learning curve is flat. No new tools and 
libraries need be learned except the programming language with wich you 
code your parser.
6. Scanless parsing with this technique can be done, if you like.
7. flexible, adaptable. It can be arbitrarily accommodate different types 
of syntax by looking ahead or backtracking in the parser code.
8. Dynamic grammar becomes possible. Because the parser is directly coded 
in your compiler,  so you can dynamically modify the rules of grammar on 
the fly.
9.You can write the parser by hand with this technique easily.

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to