Luke Palmer wrote:
grammar Grammars::Languages::C::Preprocessor {
rule CompilationUnit {
( Directive | UnprocessedStuff )*
}
rule Directive {
Hash ( Include
| Line
| Conditional
| Define
) Continuation*
}
rule
We're not quite in the world of ACME::DWIM, so you can't just replace
the important stuff with ... . :-)
Maybe, but the C preprocessor isn't important, here, for itself. Otherwise I
could cheat:
grammar Grammar::Language::C::Preprocessor {
rule CompilationUnit {
FIRST { static
Piers Cawley [EMAIL PROTECTED] wrote
Parsers with Pre-processors
I didn't quite understand what Dave Whipp was driving at when he
talked
about overloading the ws pattern as a way of doing preprocessing
of
Perl 6 patterns. I didn't understand Luke Palmer's answer either.
Help.
--- Dave Whipp [EMAIL PROTECTED] wrote:
Piers Cawley [EMAIL PROTECTED] wrote
Parsers with Pre-processors
I didn't quite understand what Dave Whipp was driving at when
he talked about overloading the ws pattern as a way of doing
preprocessing of Perl 6 patterns. I didn't understand Luke
On Mon, Jul 21, 2003 at 12:19:11PM -0700, Austin Hastings wrote:
Likewise:
my $fh = open perl.1.gz;
$fh =~ /Grammars::Languages::Runoff::Nroff(input_method
= Grammars::Languages::Runoff::tbl(input_method
= Grammars::Language::Runoff::eqn(input_method
=
Austin Hastings [EMAIL PROTECTED] wrote:
What you really want is to be able to chain grammars:
my $fh = open hello.c;
$fh =~ /Grammars::Languages::C/;
grammar Grammars::Languages::C {
method init {
SUPER::init;
$.source = (new
--- David Storrs [EMAIL PROTECTED] wrote:
On Mon, Jul 21, 2003 at 12:19:11PM -0700, Austin Hastings wrote:
Likewise:
my $fh = open perl.1.gz;
$fh =~ /Grammars::Languages::Runoff::Nroff(input_method
= Grammars::Languages::Runoff::tbl(input_method
=
--- Dave Whipp [EMAIL PROTECTED] wrote:
Austin Hastings [EMAIL PROTECTED] wrote:
$.source = (new
Grammars::Language::C::Preprocessor).open($source);
I find myself wondering if this is covered by the P6 equiv of
TieHandle.
I.e. is it just an input stream filter?
Doubtful.
Do you
Austin Hastings [EMAIL PROTECTED]
I.e. is it just an input stream filter?
Doubtful.
Do you want to do this at the grammar level, or the file level?
If you want it at the file level, you Ctie a translator (ooh! my
first p6 idiom!) to the file handle.
If you want it at the grammar level
grammar Grammars::Languages::C::Preprocessor {
rule CompilationUnit {
( Directive | UnprocessedStuff )*
}
rule Directive {
Hash ( Include
| Line
| Conditional
| Define
) Continuation*
}
rule Hash { /^\s*#\s*/ }
rule
10 matches
Mail list logo