Author: bernhard
Date: Mon Feb 20 10:40:50 2006
New Revision: 11678

Added:
   trunk/languages/bc/grammar/antlr_3/AntlrPast2PirPast.java
   trunk/languages/bc/grammar/antlr_3/BcParser.java
   trunk/languages/bc/grammar/antlr_3/BcParserLexer.java
Modified:
   trunk/languages/bc/ChangeLog
   trunk/languages/bc/grammar/antlr_3/   (props changed)
   trunk/languages/bc/grammar/antlr_3/antlr_past2pir_past.g
   trunk/languages/bc/grammar/antlr_3/bc.g
Log:
Add the generated Java code to SVN.


Modified: trunk/languages/bc/ChangeLog
==============================================================================
--- trunk/languages/bc/ChangeLog        (original)
+++ trunk/languages/bc/ChangeLog        Mon Feb 20 10:40:50 2006
@@ -1,6 +1,9 @@
 # $Id$
 
-2006-01-22     Bernhard Schmalhofer
+2006-02-20     Bernhard Schmalhofer
+        * Add the generated Java code to SVN
+
+2006-02-19     Bernhard Schmalhofer
         * Play with PASTinPIR generation for ANTLR3.
 
 2006-01-22     Bernhard Schmalhofer

Added: trunk/languages/bc/grammar/antlr_3/AntlrPast2PirPast.java
==============================================================================
--- (empty file)
+++ trunk/languages/bc/grammar/antlr_3/AntlrPast2PirPast.java   Mon Feb 20 
10:40:50 2006
@@ -0,0 +1,295 @@
+// $ANTLR 3.0ea7 grammar/antlr_3/antlr_past2pir_past.g 2006-02-20 19:18:26
+
+import org.antlr.runtime.*;
+import org.antlr.runtime.tree.*;import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
+
+public class AntlrPast2PirPast extends TreeParser {
+    public static final String[] tokenNames = new String[] {
+        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "PROGRAM", "INT", "WS"
+    };
+    public static final int INT=5;
+    public static final int WS=6;
+    public static final int PROGRAM=4;
+        public AntlrPast2PirPast(TreeNodeStream input) {
+            super(input);
+        }
+        
+
+    public String[] getTokenNames() { return tokenNames; }
+
+
+
+
+    // $ANTLR start gen_pir_past
+    // grammar/antlr_3/antlr_past2pir_past.g:19:1: gen_pir_past : ^( PROGRAM 
expr ) ;
+    public void gen_pir_past() throws RecognitionException {   
+
+
+
+        int expr1 = 0;
+
+
+        try {
+            // grammar/antlr_3/antlr_past2pir_past.g:21:3: ( ^( PROGRAM expr ) 
)
+            // grammar/antlr_3/antlr_past2pir_past.g:21:3: ^( PROGRAM expr )
+            {
+
+
+                String pirBefore
+                    =   "#!/usr/bin/env parrot\n"
+                      + "\n"
+                      + "# Do not edit this file.\n"
+                      + "# This file has been generated by Bc.java.\n"
+                      + "\n"
+                      + ".sub bc :main\n"
+                      + "  load_bytecode 'languages/punie/lib/PAST.pir'\n"
+                      + "  load_bytecode 'TGE.pbc'\n"
+                      + "  load_bytecode 'languages/punie/lib/POST.pir'\n"
+                      + "\n"
+                      + "  .local pmc stmts_children\n"
+                      + "  stmts_children = new PerlArray\n";
+
+                System.out.println( pirBefore );    
+              
+
+
+            match(input,PROGRAM,FOLLOW_PROGRAM_in_gen_pir_past61);
+
+            match(input, Token.DOWN, null);
+
+            following.push(FOLLOW_expr_in_gen_pir_past63);
+            expr1=expr();
+            following.pop();
+
+
+            match(input, Token.UP, null);
+
+
+                  String pirAfter
+                    =   "               $P20 = new 'PAST::Exp' \n"
+                      + "               $P21 = new PerlArray \n"
+                      + "               push $P21, $P" + expr1 + " \n"
+                      + "               $P20.set_node('1', 1, $P21) \n"
+                      + "       $P30 = new 'PAST::Op' \n"
+                      + "       $P31 = new PerlArray \n"
+                      + "       push $P31, $P20 \n"
+                      + "       $P30.set_node('1', 1, 'print' ,$P31) \n"
+                      + "               $P40 = new 'PAST::Exp' \n"
+                      + "               $P41 = new PerlArray \n"
+                      + "               push $P41, $P30 \n"
+                      + "               $P40.set_node('1', 1, $P41) \n"
+                      + "  $P50 = new 'PAST::Stmt' \n"
+                      + "  $P51 = new PerlArray \n"
+                      + "  push $P51, $P40 \n"
+                      + "  $P50.set_node('1', 1 ,$P51) \n"
+                      + "  push stmts_children, $P50 \n"
+                      + "               $P60 = new 'PAST::Val' \n"
+                      + "               $P60.set_node( '1', 0, '\\n' ) \n"
+                      + "               $P60.valtype( 'strqq' ) \n"
+                      + "               $P70 = new 'PAST::Exp' \n"
+                      + "               $P71 = new PerlArray \n"
+                      + "               push $P71, $P60 \n"
+                      + "               $P70.set_node('1', 1, $P71) \n"
+                      + "       $P80 = new 'PAST::Op' \n"
+                      + "       $P81 = new PerlArray \n"
+                      + "       push $P81, $P70 \n"
+                      + "       $P80.set_node('1', 1, 'print' ,$P81) \n"
+                      + "               $P90 = new 'PAST::Exp' \n"
+                      + "               $P91 = new PerlArray \n"
+                      + "               push $P91, $P80 \n"
+                      + "               $P90.set_node('1', 1, $P91) \n"
+                      + "  $P100 = new 'PAST::Stmt' \n"
+                      + "  $P101 = new PerlArray \n"
+                      + "  push $P101, $P90 \n"
+                      + "  $P100.set_node('1', 1 ,$P101) \n"
+                      + "  push stmts_children, $P100 \n"
+                      + "\n"
+                      + "  .local pmc stmts\n"
+                      + "  stmts = new 'PAST::Stmts'\n"
+                      + "  stmts.set_node('1', 1, stmts_children)\n"
+                      + "\n"
+                      + "  # Compile the abstract syntax tree down to an 
opcode syntax tree\n"
+                      + "  .local string ost_tg_source\n"
+                      + "  ost_tg_source = 
_slurp_file('languages/punie/lib/past2post.g')\n"
+                      + "  .local pmc ostgrammar\n"
+                      + "  ostgrammar = new 'TGE'\n"
+                      + "  ostgrammar.agcompile(ost_tg_source)\n"
+                      + "  .local pmc ostbuilder\n"
+                      + "  ostbuilder = ostgrammar.apply(stmts)\n"
+                      + "  .local pmc ost\n"
+                      + "  ost = ostbuilder.get('result')\n"
+                      + "  $I0 = defined ost\n"
+                      + "  unless $I0 goto err_no_ost # if OST fails stop\n"
+                      + "\n"
+                      + "  # Compile the OST down to PIR\n"
+                      + "  .local string pir_tg_source\n"
+                      + "  pir_tg_source = 
_slurp_file('languages/punie/lib/post2pir.g')\n"
+                      + "  .local pmc pirgrammar\n"
+                      + "  pirgrammar = new 'TGE'\n"
+                      + "  pirgrammar.agcompile(pir_tg_source)\n"
+                      + "  .local pmc pirbuilder\n"
+                      + "  pirbuilder = pirgrammar.apply(ost)\n"
+                      + "  .local pmc pir\n"
+                      + "  pir = pirbuilder.get('result')\n"
+                      + "  unless pir goto err_no_pir # if PIR not generated, 
stop\n"
+                      + "\n"
+                      + "  # Execute\n"
+                      + "  .local pmc pir_compiler\n"
+                      + "  .local pmc pir_compiled\n"
+                      + "  pir_compiler = compreg \"PIR\"\n"
+                      + "  pir_compiled = pir_compiler( pir )\n"
+                      + "\n"
+                      + "  pir_compiled()\n"
+                      + "\n"
+                      + "  print \"\\n\"\n"
+                      + "\n"
+                      + "  end\n"
+                      + "\n"
+                      + "  err_match_fail:\n"
+                      + "    print \"parse failed\\n\"\n"
+                      + "    goto cleanup\n"
+                      + "\n"
+                      + "  err_no_ast:\n"
+                      + "    print 'Unable to construct AST.'\n"
+                      + "    goto cleanup\n"
+                      + "\n"
+                      + "  err_no_ost:\n"
+                      + "    print 'Unable to construct OST.'\n"
+                      + "    goto cleanup\n"
+                      + "\n"
+                      + "  err_no_pir:\n"
+                      + "    print 'Unable to construct PIR.'\n"
+                      + "    goto cleanup\n"
+                      + "\n"
+                      + "  cleanup:\n"
+                      + ".end\n"
+                      + "\n"
+                      + ".sub _slurp_file\n"
+                      + "  .param string filename\n"
+                      + "  .local pmc filehandle\n"
+                      + "  filehandle = open filename, '<'\n"
+                      + "  unless filehandle goto err_no_file\n"
+                      + "  $S1 = read filehandle, 65535\n"
+                      + "  close filehandle\n"
+                      + "  .return ($S1)\n"
+                      + "  err_no_file:\n"
+                      + "    print 'Unable to open file: '\n"
+                      + "    print filename\n"
+                      + "    end\n"
+                      + ".end\n";
+
+                   System.out.print( pirAfter );    
+                
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+
+
+        }
+
+    }
+    // $ANTLR end gen_pir_past
+
+
+    public static class expr_int_1_return extends TreeRuleReturnScope {
+    };
+
+    // $ANTLR start expr_int_1
+    // grammar/antlr_3/antlr_past2pir_past.g:157:1: expr_int_1 : INT ;
+    public expr_int_1_return expr_int_1() throws RecognitionException {   
+
+        expr_int_1_return retval = new expr_int_1_return();
+        retval.start = (CommonTree)input.LT(1);
+
+
+
+        try {
+            // grammar/antlr_3/antlr_past2pir_past.g:158:5: ( INT )
+            // grammar/antlr_3/antlr_past2pir_past.g:158:5: INT
+            {
+
+            match(input,INT,FOLLOW_INT_in_expr_int_183);
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+
+            retval.stop = (CommonTree)input.LT(-1);
+        }
+
+        return retval;
+
+    }
+    // $ANTLR end expr_int_1
+
+
+
+    // $ANTLR start expr
+    // grammar/antlr_3/antlr_past2pir_past.g:162:1: expr returns [int reg] : 
expr_int_1 ;
+    public int expr() throws RecognitionException {   
+
+        int reg;
+
+        expr_int_1_return expr_int_12 = null;
+
+
+
+            reg = 10;
+          
+        try {
+            // grammar/antlr_3/antlr_past2pir_past.g:167:5: ( expr_int_1 )
+            // grammar/antlr_3/antlr_past2pir_past.g:167:5: expr_int_1
+            {
+
+            following.push(FOLLOW_expr_int_1_in_expr110);
+            expr_int_12=expr_int_1();
+            following.pop();
+
+
+
+                  String pir
+                    =   "               $P" + reg + " = new 'PAST::Val' \n"
+                      + "               $P" + reg + ".set_node( '1', 0, " + 
input.toString(expr_int_12.start,expr_int_12.stop) + " ) \n"
+                      + "               $P" + reg + ".valtype( 'num' ) \n";
+                  System.out.println( pir );    
+                
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+
+
+        }
+
+        return reg;
+
+    }
+    // $ANTLR end expr
+
+
+
+
+    public static final BitSet FOLLOW_PROGRAM_in_gen_pir_past61 = new 
BitSet(new long[]{4L});
+    public static final BitSet FOLLOW_expr_in_gen_pir_past63 = new BitSet(new 
long[]{8L});
+    public static final BitSet FOLLOW_INT_in_expr_int_183 = new BitSet(new 
long[]{2L});
+    public static final BitSet FOLLOW_expr_int_1_in_expr110 = new BitSet(new 
long[]{2L});
+
+}
\ No newline at end of file

Added: trunk/languages/bc/grammar/antlr_3/BcParser.java
==============================================================================
--- (empty file)
+++ trunk/languages/bc/grammar/antlr_3/BcParser.java    Mon Feb 20 10:40:50 2006
@@ -0,0 +1,224 @@
+// $ANTLR 3.0ea7 grammar/antlr_3/bc.g 2006-02-20 19:18:25
+
+import org.antlr.runtime.*;
+import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
+
+
+import org.antlr.runtime.tree.*;
+
+public class BcParser extends Parser {
+    public static final String[] tokenNames = new String[] {
+        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "PROGRAM", "INT", "WS", 
"\'quit\'"
+    };
+    public static final int INT=5;
+    public static final int WS=6;
+    public static final int PROGRAM=4;
+        public BcParser(TokenStream input) {
+            super(input);
+        }
+        
+    protected TreeAdaptor adaptor = new CommonTreeAdaptor();
+
+    public void setTreeAdaptor(TreeAdaptor adaptor) {
+        this.adaptor = adaptor;
+    }
+    public TreeAdaptor getTreeAdaptor() {
+        return adaptor;
+    }
+
+
+    public String[] getTokenNames() { return tokenNames; }
+
+
+
+    public static class program_return extends RuleReturnScope {
+        CommonTree tree;
+        public Object getTree() { return tree; }
+    };
+
+    // $ANTLR start program
+    // grammar/antlr_3/bc.g:21:1: program : input_item quit -> ^( PROGRAM 
input_item ) ;
+    public program_return program() throws RecognitionException {   
+
+        program_return retval = new program_return();
+        retval.start = (Token)input.LT(1);
+
+        CommonTree root_0 = null;
+
+
+        input_item_return input_item1 = null;
+
+        quit_return quit2 = null;
+
+        List list_quit=new ArrayList();
+        List list_input_item=new ArrayList();
+
+        try {
+            // grammar/antlr_3/bc.g:22:5: ( input_item quit -> ^( PROGRAM 
input_item ) )
+            // grammar/antlr_3/bc.g:22:5: input_item quit
+            {
+
+            following.push(FOLLOW_input_item_in_program61);
+            input_item1=input_item();
+            following.pop();
+
+            list_input_item.add(input_item1.tree);
+
+            following.push(FOLLOW_quit_in_program63);
+            quit2=quit();
+            following.pop();
+
+            list_quit.add(quit2.tree);
+
+
+            // AST REWRITE
+            if ( list_input_item.size()!=1 ) throw new 
RuntimeException("element input_item length="+list_input_item.size()+" != 1");
+
+            int i_0 = 0;
+            retval.tree = root_0;
+            root_0 = (CommonTree)adaptor.nil();
+            // 22:21: -> ^( PROGRAM input_item )
+            {
+                // grammar/antlr_3/bc.g:22:24: ^( PROGRAM input_item )
+                {
+                CommonTree root_1 = (CommonTree)adaptor.nil();
+                root_1 = 
(CommonTree)adaptor.becomeRoot(adaptor.create(PROGRAM, "PROGRAM"), root_1);
+
+                adaptor.addChild(root_1, list_input_item.get(i_0));
+
+                adaptor.addChild(root_0, root_1);
+                }
+
+            }
+
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+
+            retval.stop = (Token)input.LT(-1);
+            retval.tree = root_0;
+
+        }
+
+        return retval;
+
+    }
+    // $ANTLR end program
+
+
+    public static class input_item_return extends RuleReturnScope {
+        CommonTree tree;
+        public Object getTree() { return tree; }
+    };
+
+    // $ANTLR start input_item
+    // grammar/antlr_3/bc.g:25:1: input_item : INT ;
+    public input_item_return input_item() throws RecognitionException {   
+
+        input_item_return retval = new input_item_return();
+        retval.start = (Token)input.LT(1);
+
+        CommonTree root_0 = null;
+
+        Token INT3=null;
+
+        CommonTree INT3_tree=null;
+
+        try {
+            // grammar/antlr_3/bc.g:26:5: ( INT )
+            // grammar/antlr_3/bc.g:26:5: INT
+            {
+            root_0 = (CommonTree)adaptor.nil();
+
+
+            INT3=(Token)input.LT(1);
+            match(input,INT,FOLLOW_INT_in_input_item86);
+            INT3_tree = (CommonTree)adaptor.create(INT3);
+            adaptor.addChild(root_0, INT3_tree);
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+
+            retval.stop = (Token)input.LT(-1);
+            retval.tree = root_0;
+
+        }
+
+        return retval;
+
+    }
+    // $ANTLR end input_item
+
+
+    public static class quit_return extends RuleReturnScope {
+        CommonTree tree;
+        public Object getTree() { return tree; }
+    };
+
+    // $ANTLR start quit
+    // grammar/antlr_3/bc.g:34:1: quit : 'quit' ;
+    public quit_return quit() throws RecognitionException {   
+
+        quit_return retval = new quit_return();
+        retval.start = (Token)input.LT(1);
+
+        CommonTree root_0 = null;
+
+        Token string_literal4=null;
+
+        CommonTree string_literal4_tree=null;
+
+        try {
+            // grammar/antlr_3/bc.g:35:5: ( 'quit' )
+            // grammar/antlr_3/bc.g:35:5: 'quit'
+            {
+            root_0 = (CommonTree)adaptor.nil();
+
+
+            string_literal4=(Token)input.LT(1);
+            match(input,7,FOLLOW_7_in_quit116);
+            string_literal4_tree = (CommonTree)adaptor.create(string_literal4);
+            adaptor.addChild(root_0, string_literal4_tree);
+
+            }
+
+        }
+        catch (RecognitionException re) {
+            reportError(re);
+            recover(input,re);
+        }
+        finally {
+
+            retval.stop = (Token)input.LT(-1);
+            retval.tree = root_0;
+
+        }
+
+        return retval;
+
+    }
+    // $ANTLR end quit
+
+
+
+
+    public static final BitSet FOLLOW_input_item_in_program61 = new BitSet(new 
long[]{128L});
+    public static final BitSet FOLLOW_quit_in_program63 = new BitSet(new 
long[]{2L});
+    public static final BitSet FOLLOW_INT_in_input_item86 = new BitSet(new 
long[]{2L});
+    public static final BitSet FOLLOW_7_in_quit116 = new BitSet(new 
long[]{2L});
+
+}
\ No newline at end of file

Added: trunk/languages/bc/grammar/antlr_3/BcParserLexer.java
==============================================================================
--- (empty file)
+++ trunk/languages/bc/grammar/antlr_3/BcParserLexer.java       Mon Feb 20 
10:40:50 2006
@@ -0,0 +1,222 @@
+// $ANTLR 3.0ea7 grammar/antlr_3/BcParser.lexer.g 2006-02-20 19:18:25
+
+import org.antlr.runtime.*;
+import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
+
+public class BcParserLexer extends Lexer {
+    public static final int INT=5;
+    public static final int WS=6;
+    public static final int PROGRAM=4;
+    public static final int T7=7;
+    public BcParserLexer(CharStream input) {
+        super(input);
+    }
+    public Token nextToken() {
+        token=null;
+retry:
+        while (true) {
+            if ( input.LA(1)==CharStream.EOF ) {
+                return Token.EOF_TOKEN;
+            }  
+            try {
+                mTokens();
+                break retry;
+            }
+            catch (RecognitionException re) {
+                reportError(re);
+                recover(re);
+            }
+        }
+        return token;
+    }
+
+    public void mT7() throws RecognitionException {
+        int type = T7;
+        int start = getCharIndex();
+        int line = getLine();
+        int charPosition = getCharPositionInLine();
+        int channel = Token.DEFAULT_CHANNEL;
+        // grammar/antlr_3/BcParser.lexer.g:3:6: ( 'quit' )
+        // grammar/antlr_3/BcParser.lexer.g:3:6: 'quit'
+        {
+
+        match("quit");
+
+
+        }
+
+        if ( token==null ) 
{emit(type,line,charPosition,channel,start,getCharIndex()-1);}
+    }
+
+    public void mINT() throws RecognitionException {
+        int type = INT;
+        int start = getCharIndex();
+        int line = getLine();
+        int charPosition = getCharPositionInLine();
+        int channel = Token.DEFAULT_CHANNEL;
+        // grammar/antlr_3/BcParser.lexer.g:5:7: ( ( '0' .. '9' )+ )
+        // grammar/antlr_3/BcParser.lexer.g:5:7: ( '0' .. '9' )+
+        {
+
+        // grammar/antlr_3/BcParser.lexer.g:5:7: ( '0' .. '9' )+
+        int cnt1=0;
+        loop1:
+        do {
+            int alt1=2;
+            int LA1_0 = input.LA(1);
+            if ( (LA1_0>='0' && LA1_0<='9') ) {
+                alt1=1;
+            }
+
+
+            switch (alt1) {
+               case 1 :
+                   // grammar/antlr_3/BcParser.lexer.g:5:9: '0' .. '9'
+                   {
+
+                   matchRange('0','9');
+
+                   }
+                   break;
+
+               default :
+                   if ( cnt1 >= 1 ) break loop1;
+                    EarlyExitException eee =
+                        new EarlyExitException(1, input);
+                    throw eee;
+            }
+            cnt1++;
+        } while (true);
+
+
+        }
+
+        if ( token==null ) 
{emit(type,line,charPosition,channel,start,getCharIndex()-1);}
+    }
+
+    public void mWS() throws RecognitionException {
+        int type = WS;
+        int start = getCharIndex();
+        int line = getLine();
+        int charPosition = getCharPositionInLine();
+        int channel = Token.DEFAULT_CHANNEL;
+        // grammar/antlr_3/BcParser.lexer.g:7:6: ( ( (' '|'\t'|'\r'|'\n'))+ )
+        // grammar/antlr_3/BcParser.lexer.g:7:6: ( (' '|'\t'|'\r'|'\n'))+
+        {
+
+        // grammar/antlr_3/BcParser.lexer.g:7:6: ( (' '|'\t'|'\r'|'\n'))+
+        int cnt2=0;
+        loop2:
+        do {
+            int alt2=2;
+            int LA2_0 = input.LA(1);
+            if ( (LA2_0>='\t' && LA2_0<='\n')||LA2_0=='\r'||LA2_0==' ' ) {
+                alt2=1;
+            }
+
+
+            switch (alt2) {
+               case 1 :
+                   // grammar/antlr_3/BcParser.lexer.g:7:8: (' 
'|'\t'|'\r'|'\n')
+                   {
+
+                   if ( (input.LA(1)>='\t' && 
input.LA(1)<='\n')||input.LA(1)=='\r'||input.LA(1)==' ' ) {
+                       input.consume();
+                       errorRecovery=false;
+                   }
+                   else {
+                       MismatchedSetException mse =
+                           new MismatchedSetException(null,input);
+                       recover(mse);    throw mse;
+                   }
+
+
+                   }
+                   break;
+
+               default :
+                   if ( cnt2 >= 1 ) break loop2;
+                    EarlyExitException eee =
+                        new EarlyExitException(2, input);
+                    throw eee;
+            }
+            cnt2++;
+        } while (true);
+
+
+
+         channel = 99;
+         
+
+        }
+
+        if ( token==null ) 
{emit(type,line,charPosition,channel,start,getCharIndex()-1);}
+    }
+
+    public void mTokens() throws RecognitionException {
+        // grammar/antlr_3/BcParser.lexer.g:1:10: ( T7 | INT | WS )
+        int alt3=3;
+        switch ( input.LA(1) ) {
+        case 'q':
+            alt3=1;
+            break;
+        case '0':
+        case '1':
+        case '2':
+        case '3':
+        case '4':
+        case '5':
+        case '6':
+        case '7':
+        case '8':
+        case '9':
+            alt3=2;
+            break;
+        case '\t':
+        case '\n':
+        case '\r':
+        case ' ':
+            alt3=3;
+            break;
+        default:
+
+            NoViableAltException nvae =
+                new NoViableAltException("1:1: Tokens : ( T7 | INT | WS );", 
3, 0, input);
+
+            throw nvae;
+        }
+
+        switch (alt3) {
+            case 1 :
+                // grammar/antlr_3/BcParser.lexer.g:1:10: T7
+                {
+
+                mT7();
+
+                }
+                break;
+            case 2 :
+                // grammar/antlr_3/BcParser.lexer.g:1:13: INT
+                {
+
+                mINT();
+
+                }
+                break;
+            case 3 :
+                // grammar/antlr_3/BcParser.lexer.g:1:17: WS
+                {
+
+                mWS();
+
+                }
+                break;
+
+        }
+
+    }
+
+
+}
\ No newline at end of file

Modified: trunk/languages/bc/grammar/antlr_3/antlr_past2pir_past.g
==============================================================================
--- trunk/languages/bc/grammar/antlr_3/antlr_past2pir_past.g    (original)
+++ trunk/languages/bc/grammar/antlr_3/antlr_past2pir_past.g    Mon Feb 20 
10:40:50 2006
@@ -11,6 +11,12 @@ options
   tokenVocab   = 'grammar/antlr_3/BcParser';
 }
 
+// XXX I can't find this in the generated Java code, a bug in ANTLR3 ea7?
[EMAIL PROTECTED] 
+{
+  int asdf = 200;
+}
+
 gen_pir_past 
   :
   {
@@ -35,7 +41,7 @@ gen_pir_past 
       String pirAfter
         =   "               \$P20 = new 'PAST::Exp' \n"
           + "               \$P21 = new PerlArray \n"
-          + "               push \$P21, \$P10 \n"
+          + "               push \$P21, \$P" + $expr.reg + " \n"
           + "               \$P20.set_node('1', 1, \$P21) \n"
           + "       \$P30 = new 'PAST::Op' \n"
           + "       \$P31 = new PerlArray \n"

Modified: trunk/languages/bc/grammar/antlr_3/bc.g
==============================================================================
--- trunk/languages/bc/grammar/antlr_3/bc.g     (original)
+++ trunk/languages/bc/grammar/antlr_3/bc.g     Mon Feb 20 10:40:50 2006
@@ -18,7 +18,6 @@ tokens 
   PROGRAM;
 } 
 
-
 program 
   : input_item quit -> ^( PROGRAM input_item )
   ;

Reply via email to