Re: Parse::RecDescent demo fails hello.c !?
[email protected] ((Randal L. Schwartz)) 09 Oct 2003 10:57:51 -0700
| Newsgroups | perl.recdescent |
|---|---|
| Organization | Stonehenge Consulting Services; Portland, Oregon, USA |
| Message-ID | <[email protected]> |
>>>>> "kynn" == kynn <[email protected]> writes: kynn> [ I originally posted this in comp.lang.perl.modules. A responder kynn> suggested I sent it to this address. ] kynn> I'm trying to learn how to use Parse::RecDescent, so I tried the kynn> script demo_Cgrammar.pl that comes with the Parse::RecDescent kynn> distribution with Kernighan & Ritchie's canonical hello.c as input. kynn> Here's what I get: kynn> $ cat hello.c kynn> #include <stdio.h> kynn> main() kynn> { kynn> printf("Hello, world.\n"); kynn> } And the answer you got there was "CPP is meta to C grammar, so the C grammar parser chokes on that". You need to preprocess your file, then feed the output of that to the C grammar. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[email protected]> <URL:http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!