Ah, I was wondering where that late upvote was co
ming from. I think my
MarpaX::Languages::C::AST�answer showcases the best of Perl
(�glue language�) and Marpa to offer a concise � and more
importantly: correct � solution to an otherwise difficult
problem.
On the other hand it shows how fundamentally awkward it can
be to work with a Marpa-generated AST. The SLIF offers the
"bless" adverb, but only supports arrays as reference type.
For a Marpa user, this causes problems when�
- �wanting to use standard hash-based objects, or
- �using more advanced object systems like Moose, Mouse,
Moo, or p5-mop: external "bless"ings violate
encapsulation.
It is also a Perl 5-ism that does not translate well to
other host languages. I am of the opinion that it might have
been a better design choice to invoke the appropriate
constructor instead of "bless"ing a reference (which would
have had the side effect of forcing Jean-Damien to write handy
accessors for MarpaX::Languages::C::AST�). Is it�your opinion
that this problem has a satisfactory solution by wrapping the
constructors in "action"s, or do you concur that syntactic
sugar like a "new" adverb could make the SLIF more expressive?
As an aside, I am currently considering to write another
tutorial in the spirit of �affordable languages�: The
LLVM
Kaleidoscope tutorial�spends a bit too much time writing
a simplistic parser which could have been used on more
interesting topics of language implementation. I went through
the OCaml version of that tutorial some time ago, so it would
be fun to use the Perl bindings this time, using Marpa for the
parser.