The use of the NAIF is one of the IRIF's many interesting choices, and
very informative for me. I *had* planned to drop the NAIF the moment I
started Marpa::R3. But if I want IRIF branch of innovation and others
like it to carry over into R3 (and I very much do), then obviously I
must either keep the NAIF or offer an even better replacement.
It turns out that internally, the SLIF needs its own named argument
interface. This is because the SLIF is self-compiling. That means
whenever if I break the SLIF's self-compile in development, I cannot
compile anything -- a very nasty circular dependency. To get around
this, I have an intermediate NAIF-like interface, which is not nearly so
convenient as the SLIF, but is hackable. I can hack this, intervening
manually in what usually is the SLIF's self-compilation of its
meta-grammar. Once I manually get the SLIF's meta-grammar to compile, I
can test and fix the broken SLIF self-compilation. Once I no longer
need to manually intervene to get the SLIF's meta-grammar to compile,
the cycle is restored and I can move on. I rarely need to do this, but
when I do, the SLIF's intermediate form is a life-saver.
Anyway, if I can stabilize and document the SLIF's intermediate
representation (two *big* if's) then it might be an alternative to the
NAIF which offers the best of both worlds -- no tie-in to SLIF features,
but (unlike the NAIF) support for all the cool new features if you want
them.
-- jeffrey
On 01/05/2014 06:08 AM, amon wrote:
My current implementation does /not/ compile to the SLIF, but to the
NAIF: data structures are easier to handle than strings. This also
avoids generating unicorn rules. My compiler works in three stages:
1. DSL → High-level AST which can be used for pretty-printing.
2. High-level AST → Low-level AST which removes any nesting and
assigns a LHS to each rule. This could be re-targeted to an
existing AST.
3. Low-level AST → NAIF which checks referential integrity of the
grammar. This could be re-targeted to the SLIF without too many
problems when using external lexing. However this only seems
useful for educational purposes, not as an implementation strategy.
I will not re-use the SLIF metagrammar, because
* features like character classes and attributes are largely
replaced in the IRIF by regexes and syntactic sugar,
* captures are handled radically different, and parens are
repurposed for nesting,
* SKIP rule insertions in the IRIF (not yet implemented) is best
done during DSL parsing,
* new syntax like inline actions and macros (not yet implemented)
make further changes necessary.
In short, the IRIF isn't an extension of the SLIF, it's a re-imagination.
--
You received this message because you are subscribed to the Google Groups "marpa
parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to marpa-parser+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.