RE: simple grammar example

2004-06-09 Thread Garrett Goebel
Aldo Calpini wrote: > > I'm preparing a talk about Perl6 for the Italian Perl Workshop, and I > would like to have a slide comparing a BNF (yacc/bison) grammar to a > Perl6 one, to show how powerful in parsing/lexing > Perl6 regexen are. > > so I ask your assistance in helping me putting up a s

Re: simple grammar example

2004-06-09 Thread Rafael Garcia-Suarez
Luke Palmer wrote: > That left recursion won't do. I can't remember my transformation rules > well enough to know how to put that in a form suitable for a recursive > descent parser. To be honest, I've never seen an RPN calculator modeled > with a grammar. Well, the main advantage of an RPM synt

Re: simple grammar example

2004-06-09 Thread Luke Palmer
Rafael Garcia-Suarez writes: > Luke Palmer wrote: > > Also, if this is going to be an explanation rather than just a picture, > > I suggest you go with Perl's usual versatile power, and store the > > operators in a declarative data source. > > > > grammar RPN { > > my @operator = << +

Re: simple grammar example

2004-06-09 Thread Sean O'Rourke
[EMAIL PROTECTED] (Rafael Garcia-Suarez) writes: > Sean O'Rourke wrote: >> * To really show where P6 rocks, you need to show dynamic features. A >> simple example might be using a language with keywords kept in >> variables, allowing you change between e.g. "for, while, if", "pour, >> tandi

Re: simple grammar example

2004-06-09 Thread Rafael Garcia-Suarez
Sean O'Rourke wrote: > * To really show where P6 rocks, you need to show dynamic features. A > simple example might be using a language with keywords kept in > variables, allowing you change between e.g. "for, while, if", "pour, > tandis-que, si", etc. Small correction : "pour, tant_que, si

Re: simple grammar example

2004-06-09 Thread Rafael Garcia-Suarez
Luke Palmer wrote: > Also, if this is going to be an explanation rather than just a picture, > I suggest you go with Perl's usual versatile power, and store the > operators in a declarative data source. > > grammar RPN { > my @operator = << + - * / >>; > > rule input { * } >

Re: simple grammar example

2004-06-09 Thread Sean O'Rourke
[EMAIL PROTECTED] (Aldo Calpini) writes: > I'm preparing a talk about Perl6 for the Italian Perl Workshop, and I > would like to have a slide comparing a BNF (yacc/bison) grammar to a > Perl6 one, to show how powerful in parsing/lexing Perl6 regexen are. > ... > am I missing something obvious here?

Re: simple grammar example

2004-06-09 Thread Luke Palmer
Aldo Calpini writes: > I've taken this bison example (an RPN calculator, stripped down version > from http://www.gnu.org/software/bison/manual/html_node/Rpcalc-Rules.html): > > input:/* empty */ > | input line > ; > > line: '\n' > | exp '\n' > ; > > exp: NUM

simple grammar example

2004-06-09 Thread Aldo Calpini
hello gentlemen, I'm preparing a talk about Perl6 for the Italian Perl Workshop, and I would like to have a slide comparing a BNF (yacc/bison) grammar to a Perl6 one, to show how powerful in parsing/lexing Perl6 regexen are. so I ask your assistance in helping me putting up a simple, yet impres