gesamt: methodenaufrufe der art 'ID(...)'
[uebersetzerbau-ss10.git] / gesamt / parser.y
index 9c1309de18678d78a85eac4605db75eef34ba2db..052e67faa178644c8da3d9724ea5699696259665 100644 (file)
@@ -40,7 +40,7 @@
  * sin: symboltabelle fuer statement ("eingabe")
  * sout: symboltabelle die aus einem statement wieder rauskommt ("ausgabe")
  */
-@autoinh s gparamges
+@autoinh s gparamges vars_in
 @autosyn node imm call
 
 @attributes { char *name; } IDENT
 @attributes { struct symbol *f; } Program Structdef;
 @attributes { struct symbol *f; int offsetcount; } FeldID
 @attributes { struct symbol *s; } Methoddef
-@attributes { struct symbol *s; int gparamges; } Exprs
+@attributes { struct symbol *s; int gparamges; int vars_in; int paramcount; struct treenode *node; } Exprs
 @attributes { struct symbol *s; int gparamges; int lblcnt_in; int lblcnt_out; int vars_in; int vars_out; int call; } Statseq
 @attributes { struct symbol *s; int gparamges; int lblcnt_in; int lblcnt_out; int reallblcnt; int vars_in; int vars_out; int call; } Elsestat
-@attributes { struct symbol *s; int gparamges; struct treenode *node; short imm; int call; } Expr Minusterm Multerm Orterm Feld Term
-@attributes { struct symbol *s; int gparamges; struct treenode *node; } Lexpr
+@attributes { struct symbol *s; int gparamges; int vars_in; struct treenode *node; short imm; int call; } Expr Minusterm Multerm Orterm Feld Term
+@attributes { struct symbol *s; int gparamges; int vars_in; struct treenode *node; } Lexpr
 @attributes { struct symbol *sin; int gparamges; struct symbol *sout; struct treenode *node; int vars_in; int vars_out; int lblcnt_in; int lblcnt_out; int call; } Statement
 
 @traversal @postorder c
@@ -556,9 +556,15 @@ Term:
 
        | IDENT '(' Exprs ')'
          @{
-           @i @Term.node@ = new_call(@IDENT.name@, TREENULL, TREENULL);
+               /* TODO: soffset sollte eigentlich anzahl des paramcounts in Exprs + vars die existieren sein */
+           @i {
+                       @Term.node@ = new_call(@IDENT.name@, new_arg(new_nothing(), new_nothing(), 0) /*this*/,
+                                       @Exprs.node@, @Term.gparamges@, @Term.vars_in@);
+                       @Term.node@->soffset = @Exprs.paramcount@;
+               }
                @i @Term.imm@ = 0;
                @i @Term.call@ = 1;
+               @reg @Exprs.node@->reg = @Term.node@->reg;
          @}
 
        | Term '.' IDENT '(' Exprs ')'
@@ -572,8 +578,22 @@ Term:
 
 Exprs:
          Expr ',' Exprs
+         @{
+               @i @Exprs.0.node@ = new_arg(@Expr.0.node@, @Exprs.1.node@, @Exprs.1.paramcount@);
+               @i @Exprs.0.paramcount@ = @Exprs.1.paramcount@ + 1;
+               @reg @Expr.node@->reg = @Exprs.1.node@->reg = @Exprs.0.node@->reg;
+         @}
        | Expr
+         @{
+               @i @Exprs.0.node@ = new_arg(@Expr.0.node@, new_nothing(), 1);
+               @i @Exprs.paramcount@ = 2;
+               @reg @Expr.node@->reg = @Exprs.0.node@->reg;
+         @}
        |
+         @{
+               @i @Exprs.0.node@ = new_nothing();
+               @i @Exprs.paramcount@ = 1;
+         @}
        ;
 %%