How to use 2 different parsers in 1 program?
kjstol
parrotcode at gmail.com
Tue Feb 3 00:13:04 UTC 2009
I'm working on a little project, using 2 languages in 1 program.The first
parser is needed to parse the 'configuration', which is stored in a file.
The second parser is then needed to parse and handle the command-line input
for user input (it was supposed to be the start of a text adventure engine).
So, invocation would be: (assuming the language at hand is called 'pal')
parrot pal.pbc foo.pal
which handles the configuration file, after which I expect (and get) a
command line prompt.
However, it seems I cannot get this to work
I created a HLLCompiler object for each of the (disjoint) languages, and set
the attributes properly (grammar, actions, language)
There's 2 grammars involved, and 2 actions files. All of these files are
compiled into PIR, and .include-d.
The first compilation works fine. Then, I invoke the second parser, which
does get activated (there is a commandline prompt), but whatever I put in,
it's "Failed to parse source".
I tried to invoke 'interactive' method on the second compiler, instead of
'command_line', but this didn't work.
I tried to pass "target"=>"parse" to the 'interactive' method, but that
didn't work either.
I also tried to re-set the parsegrammar and parseactions on the first
compiler, after compilation of the configuration file.
Pretty much all combinations I tried, but nothing seems to work.
Somehow, I get the feeling that there's some state or something being
stored, which needs to be reset. That's just a wild guess of course.
Anybody any clue?
thanks,
kjs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.parrot.org/pipermail/parrot-dev/attachments/20090203/8cda67bd/attachment.htm
More information about the parrot-dev
mailing list