http://qs321.pair.com?node_id=11121228

LanX has asked for the wisdom of the Perl Monks concerning the following question:

Hi

I looked in App::a2p trying to understand how awk is translated to Perl

... but it's written in C, which is

As far as I can see are big parts generated parser code via YACC (and lex ?)and these seem to have been defined by the following grammar rules:

From https://metacpan.org/source/LEONT/App-a2p-1.013/a2p.c

Question: Is there an obvious way to translate this to Perl regexes?

A result could be a parse tree, inspected by a walker to generate Perl code.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

UPDATE

I just realized that the real YACC/LEX rules are only available on GitHub

https://github.com/Leont/app-a2p/blob/master/a2p.y

Leon pruned this file from the CPAN version.

This makes obviously more sense than decipering the generated C-files.