Dan Sugalski: # At 04:40 PM 9/28/2001 -0700, Brent Dax wrote: # >Simon Cozens: # ># On Fri, Sep 28, 2001 at 12:55:08PM -0400, Pat Eyler wrote: # ># > On Fri, 2001-09-28 at 12:31, Will Coleda wrote: # ># > > Due to a bad case of congenital insanity, I have # ># developed a barely # ># > > functional tcl to pasm compiler. # ># > # ># > Okay, I'll step up now too. I'm working on a ruby-like # ># language that # ># > compiles to pasm. # ># # ># And yesterday we saw a Python one. Damn, this is depressing. Anyone # ># want to port Perl? :) # > # >I was actually thinking about building a compiler (in Perl 5) called # >"babyperl" (Babytalk Perl) that recognizes a subset of Perl 6, so # >anything this compiler will accept Perl 6 will too. It # could actually # >be a good way to bootstrap ourselves to a true Perl 6 parser. # >Unfortunately, I'm not really sure if Parrot is ready to support # >anything like that--I'll consider it. # # Parrot's as ready to support it as it is, say, Tcl or Python. # The compilers # for those languages only support a small subset and use the # int/float/string registers for them.
Fair enough, I'm starting on this. I've pasted the Parse::RecDescent grammar I'm thinking of using below my sig; let me know if you spot any problems with it. I'm not implementing operator prescedence (at least not yet). --Brent Dax [EMAIL PROTECTED] Configure pumpking for Perl 6 They *will* pay for what they've done. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ start: statement(s ';') statement: expression | declaration | command expression: IDENT | IDENT '(' expression(s /,/) ')' | expression BINOP expression | UNOP expression | value declaration: 'our' IDENT '(' VARIABLE ')' command: if_command | ifelse_command | while_command | dowhile_command if_command: IF '(' expression ')' BLOCK ifelse_command: IF '(' expression ')' BLOCK else BLOCK while_command: WHILE '(' expression ')' BLOCK dowhile_command: 'do' BLOCK WHILE '(' expression ')' value: CONSTANT | VARIABLE IF: 'if' | 'unless' WHILE: 'while' | 'until' BLOCK: '{' statement(s ';') '}' CONSTANT: /[+-]\d+(?:\.\d+)?/ | /['"].*?(?<!\\)\1/ VARIABLE: '$' IDENT | '${' IDENT '}' BINOP: '+' | '-' | '*' | '/' | '%' | '~' | 'x' | '=' | '+=' | '-=' | '*=' | '/=' | '%=' | '~=' | 'x=' | '>' | '<' | '==' | 'lt' | 'gt' | 'eq' | '<=' | '>=' | '!=' | 'ge' | 'le' | 'ne' | '&&' | '||' | 'and'| 'or' UNOP: '-' | '+' | '!' IDENT: /\w+/