Professor Tonneau,What is the general BNF of the Pliant language?Thank you!

Message posted by maybe Hubert Tonneau on2007/02/05 14:24:18

Pliant parser is not relying on grammar notion.

It's guts are: token parsing, then rewritting.

For parsing token, we have an ordered set of rules (each rule is a function thatis responsinle for recognising one kind of token. An example could be a rulerecognising a floatting point value).In very fiew words, a token parsing rule function either fails (meaning what comesnext is not something I've been designed to recognise), or adds an objectto the output tree of the parser and move the parsing cursor forward.

Now, rewritting rules (also an ordered list of functions) just travel the outputtree (which is just a list after token parsing took place) and fold it.An example could be a rule saying that 'A' '+' 'B' must be folded as ('+' 'A' 'B')

Now, what makes the connection with grammars hard is that:. any Pliant module can provide new rules (so change the overall equivalent grammar). modules visibility apply to parser rules, so some rules apply only if the current module did include another one, so you don't have a single grammar for Pliant, but potencially 2^n where n is the number of modules providing parser rules

My point of view, also probably not widely accepted, is that the mainadvantage of grammars is to provide optimal parsing speed, but we don't carebecause parsing time is just negligeable when compared to code optimisationtime.