Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Top-down parsing language
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Generalized TDPL == A slight variation of TDPL, known as '''Generalized TDPL''' or GTDPL, greatly increases the apparent expressiveness of TDPL while retaining the same minimalist approach (though they are actually equivalent). In GTDPL, instead of TDPL's recursive rule form ''A'' β ''BC/D'', the rule form ''A'' β ''B[C,D]'' is used. This rule is interpreted as follows: When nonterminal ''A'' is invoked on some input string, it first recursively invokes ''B''. If ''B'' succeeds, then ''A'' subsequently invokes ''C'' on the remainder of the input left unconsumed by ''B'', and returns the result of ''C'' to the original caller. If ''B'' fails, on the other hand, then ''A'' invokes ''D'' on the original input string, and passes the result back to the caller. The important difference between this rule form and the ''A'' β ''BC/D'' rule form used in TDPL is that ''C'' and ''D'' are never ''both'' invoked in the same call to ''A'': that is, the GTDPL rule acts more like a "pure" if/then/else construct using ''B'' as the condition. In GTDPL it is straightforward to express interesting non-[[context-free language]]s such as the classic example {a<sup>''n''</sup>b<sup>''n''</sup>c<sup>''n''</sup>}. A GTDPL grammar can be reduced to an equivalent TDPL grammar that recognizes the same language, although the process is not straightforward and may greatly increase the number of rules required.<ref name="Ford">Ford, Bryan. ''[http://pdos.csail.mit.edu/~baford/packrat/popl04/peg-popl04.pdf Parsing Expression Grammars: A Recognition-Based Syntactic Foundation]''</ref> Also, both TDPL and GTDPL can be viewed as very restricted forms of [[parsing expression grammar]]s, all of which represent the same class of grammars.<ref name="Ford"/>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)