|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
predictive parsing and non-recursive predictive parsing
usually covered. But there is a less-known, elegant recursive
formulation for LR parsers as well. Google "recursive LR parser" for a few papers. Is this what is refered to as Recursive Ascent ? Aaron |
|
#2
|
|||
|
|||
|
predictive parsing and non-recursive predictive parsing
Is this what is refered to as Recursive Ascent ?
It is indeed. > >1) How does it work as I cannot remember, it was used in Philip's Elegant >Compiler compiler infrastructure, which I looked at some eight years ago. >Would you please give a description of how it works for those who don't >know. > Basically, you use the call stack as a replacement of the explicit stack. A shift is a call and a reduce is a return (through several stack levels). > A reasonably good account can be found in "The Essense of LR Parsing" by Sperber and Thiemann (PEPM'95, ACM Press). It includes several different implementations in Scheme and a description of how you can use partial evaluation to generate specialised parsers from the general parser. Thanks. >2) Is it limited to LR(1) lookahead wise ? > No. This is very interesting. So you could implement lookahead before doing the shift as a "guard". So you could get a very fast LR(k) parser using this technique, although there is the problem of error recovery which a no recursive table driven parser does much easier. Interesting diversion :) Aaron |
![]() |
| Viewing: Web Development Archives > FAQs > Compilers > predictive parsing and non-recursive predictive parsing |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|