Java to Perl Grammar snag

philcrow on 2007-04-16T23:01:55

I've hit a snag with my Java to Perl 6 API converter. Apparently pugs grammars are not yet returning ASTs as the synopsis describes.

I'm still weighing what to do about that. There are several options. Of course, I could learn Haskell and pitch in on the grammar internals of Perl 6, but that seems unlikely. I'd be starting from scratch on Haskell, having never coded in a functional language before, with almost no background in grammar implementation (one admittedly close reading of the dragon book notwithstanding).

Alternatively, I could approach this as an exercise in Perl 6 generation where the implementation language of the generator is immaterial. This is not ideal, because part of why I wanted to work on this project was to learn about Perl 6 grammars. But it would enable me to implement something. Then I would implement the code in Perl 5, waiting for the right moment to translate it to Perl 6.

Or, if grammars building ASTs are imminent, I could wait for the features to appear, then start.

I'm leaning heavily toward implementing in Perl 5, but have not yet firmly decided.

In the meantime, I've been thinking (with help from Tim Bunce) about the structure of the AST I want the grammar to build. The design sketch is basically done.

All that is to say, that I hope to make some coding progress this week.

Phil


Coding progress

Ron Savage on 2007-04-17T01:13:19

Gee, I've never heard of that!

Is it a Perl6 built-in :-))?

Parrot?

chromatic on 2007-04-17T01:47:10

Parrot's PGE returns ASTs. Is that reasonably close to or exceedingly far from what you need?

how about 6-on-6

fglock on 2007-04-17T13:34:04

There are several options under development in perl6-in-perl6 land. Have you considered mp6, or kp6 (parser returns object tree)? There is also v6.pm (Perl6-in-Perl5): parser generate HoH; grammars generate perl5 modules.