Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

ChrisDolan (2855)

ChrisDolan
  (email not shown publicly)
http://www.chrisdolan.net/

Journal of ChrisDolan (2855)

Wednesday July 23, 2008
01:02 AM

More Yacc to Parrot translation

[ #36992 ]

I mentioned a while back that I was playing with a PCT-based grammar to parse Yacc files and transcode the Yacc grammar to PCT.

My project took two big detours.

First, I re-learned that Yacc is a parser for a pre-tokenized stream and does not include lexing or scanning, unlike PCT. So it is infeasible to do a full, automated translation. I suspected that would be the case when I started, but I didn't realize how far from complete my translation would be. Basically, I generate a lot of mostly-useful PGE "rule {}" constructs, but then a lot of placeholder "token {}" constructs that need to be addressed by a human.

The second detour was that I was trying to learn Yacc and PCT/PGE at the same time, which was too much. So, I dropped down to Perl5 and wrote a parser based on the m/\G.../cgxms construct. The good news is that I finished, and the parser is blazing fast, if verbose. I can parse the whole Yacc vocabulary (well, Bison v2.1 really). My testcases are perl/perly.y, bash/parse.y, cola.y, lua51.y and even bison/parse-gram.y. I am generating PCT grammar.pg and actions.pm files that actually compile, but they are far from functional -- they're just starting points, really, but they're better than a blank page I think.

So, opinions are welcome:

  • Should I continue working on the Perl5 parser to get it to make better PCT output?
  • Should I work on porting the parser itself to PCT?
  • Should I put this aside and start using it to make real Parrot code from existing Yacc grammars?
  • Or should I work on the RT/CPANTesters bugs that have been accumulating against my existing packages? Sigh...
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.