[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: treecc/tests output16.out,NONE,1.1 output16.
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: treecc/tests output16.out,NONE,1.1 output16.tst,NONE,1.1 test_list,1.3,1.4 |
Date: |
Mon, 30 Dec 2002 16:54:16 -0500 |
Update of /cvsroot/dotgnu-pnet/treecc/tests
In directory subversions:/tmp/cvs-serv8880/tests
Modified Files:
test_list
Added Files:
output16.out output16.tst
Log Message:
Add the "internal_access" and "public_access" options, so that
treecc can output assembly-private node definitions.
--- NEW FILE ---
line 4: %option lang C#
line 5: %option namespace Test
line 6: %option internal_access
line 8: %node type_code no_parent 14
line 10: %node int_type type_code 16
line 11: %node float_type type_code 16
line 14: %node expression no_parent 6
line 16: %field type type_code type_code.int_type 1
line 19: %node binary expression 2
line 21: %field expr1 expression no_value 0
line 22: %field expr2 expression no_value 0
line 25: %node unary expression 2
line 28: %field expr expression no_value 0
line 32: %node intnum expression 0
line 34: %field num int no_value 0
line 37: %node plus binary 0
line 38: %node minus binary 0
line 39: %node multiply binary 0
line 40: %node divide binary 0
line 41: %node negate unary 0
line 42: %node power binary 0
line 44: %operation void Infer::infer_type 2
line 44: %param expression e 1
line 46: %case binary infer_type
line 66: %case unary infer_type
line 72: %case intnum infer_type
line 77: %case power infer_type
line 90: %operation void infer_virtual 1
line 90: %param expression e 1
line 90: %virtual expression infer_virtual
line 92: %case binary infer_virtual
line 112: %case unary infer_virtual
line 118: %case intnum infer_virtual
line 123: %case power infer_virtual
/* output.c. Generated automatically by treecc */
namespace Test
{
using System;
internal enum type_code
{
int_type,
float_type,
}
internal class YYNODESTATE
{
private static YYNODESTATE state__;
public static YYNODESTATE getState()
{
if(state__ != null) return state__;
state__ = new YYNODESTATE();
return state__;
}
public YYNODESTATE() { state__ = this; }
public virtual String currFilename() { return null; }
public virtual long currLinenum() { return 0; }
}
internal abstract class expression
{
protected int kind__;
protected String filename__;
protected long linenum__;
public int getKind() { return kind__; }
public String getFilename() { return filename__; }
public long getLinenum() { return linenum__; }
public void setFilename(String filename) { filename__ = filename; }
public void setLinenum(long linenum) { linenum__ = linenum; }
public const int KIND = 4;
public type_code type;
protected expression()
{
this.kind__ = KIND;
this.filename__ = YYNODESTATE.getState().currFilename();
this.linenum__ = YYNODESTATE.getState().currLinenum();
this.type = type_code.int_type;
}
public abstract void infer_virtual();
public virtual int isA(int kind)
{
if(kind == KIND)
return 1;
else
return 0;
}
public virtual String getKindName()
{
return "expression";
}
}
internal class binary : expression
{
public new const int KIND = 5;
public expression expr1;
public expression expr2;
protected binary(expression expr1, expression expr2)
: base()
{
this.kind__ = KIND;
this.expr1 = expr1;
this.expr2 = expr2;
}
public override void infer_virtual()
#line 93 "output16.tst"
{
binary e = this;
type_code type1, type2;
e.expr1.infer_virtual();
type1 = e.expr1.type;
e.expr2.infer_virtual();
type2 = e.expr2.type;
if(type1 == type_code.float_type || type_code.type2 ==
float_type)
{
e.type = type_code.float_type;
}
else
{
e.type = type_code.int_type;
}
}
#line 111 "output.c"
public override int isA(int kind)
{
if(kind == KIND)
return 1;
else
return base.isA(kind);
}
public override String getKindName()
{
return "binary";
}
}
internal class unary : expression
{
public new const int KIND = 6;
public expression expr;
protected unary(expression expr)
: base()
{
this.kind__ = KIND;
this.expr = expr;
}
public override void infer_virtual()
#line 113 "output16.tst"
{
unary e = this;
e.expr.infer_virtual();
e.type = e.expr.type;
}
#line 148 "output.c"
public override int isA(int kind)
{
if(kind == KIND)
return 1;
else
return base.isA(kind);
}
public override String getKindName()
{
return "unary";
}
}
internal class intnum : expression
{
public new const int KIND = 7;
public int num;
public intnum(int num)
: base()
{
this.kind__ = KIND;
this.num = num;
}
public override void infer_virtual()
#line 119 "output16.tst"
{
intnum e = this;
e.type = type_code.int_type;
}
#line 184 "output.c"
public override int isA(int kind)
{
if(kind == KIND)
return 1;
else
return base.isA(kind);
}
public override String getKindName()
{
return "intnum";
}
}
internal class plus : binary
{
public new const int KIND = 8;
public plus(expression expr1, expression expr2)
: base(expr1, expr2)
{
this.kind__ = KIND;
}
public override int isA(int kind)
{
if(kind == KIND)
return 1;
else
return base.isA(kind);
}
public override String getKindName()
{
return "plus";
}
}
internal class minus : binary
{
public new const int KIND = 9;
public minus(expression expr1, expression expr2)
: base(expr1, expr2)
{
this.kind__ = KIND;
}
public override int isA(int kind)
{
if(kind == KIND)
return 1;
else
return base.isA(kind);
}
public override String getKindName()
{
return "minus";
}
}
internal class multiply : binary
{
public new const int KIND = 10;
public multiply(expression expr1, expression expr2)
: base(expr1, expr2)
{
this.kind__ = KIND;
}
public override int isA(int kind)
{
if(kind == KIND)
return 1;
else
return base.isA(kind);
}
public override String getKindName()
{
return "multiply";
}
}
internal class divide : binary
{
public new const int KIND = 11;
public divide(expression expr1, expression expr2)
: base(expr1, expr2)
{
this.kind__ = KIND;
}
public override int isA(int kind)
{
if(kind == KIND)
return 1;
else
return base.isA(kind);
}
public override String getKindName()
{
return "divide";
}
}
internal class power : binary
{
public new const int KIND = 13;
public power(expression expr1, expression expr2)
: base(expr1, expr2)
{
this.kind__ = KIND;
}
public override void infer_virtual()
#line 124 "output16.tst"
{
power e = this;
e.expr1.infer_virtual();
e.expr2.infer_virtual();
if(e.expr2.type != type_code.int_type)
{
error("second sub-expression to `^' is not an integer");
}
e.type = e.expr1.type;
}
#line 321 "output.c"
public override int isA(int kind)
{
if(kind == KIND)
return 1;
else
return base.isA(kind);
}
public override String getKindName()
{
return "power";
}
}
internal class negate : unary
{
public new const int KIND = 12;
public negate(expression expr)
: base(expr)
{
this.kind__ = KIND;
}
public override int isA(int kind)
{
if(kind == KIND)
return 1;
else
return base.isA(kind);
}
public override String getKindName()
{
return "negate";
}
}
internal class Infer
{
public static void infer_type(expression e__)
{
switch(e__.getKind())
{
case power.KIND:
{
power e = (power)e__;
#line 78 "output16.tst"
{
infer_type(e.expr1);
infer_type(e.expr2);
if(e.expr2.type != type_code.int_type)
{
error("second sub-expression to
`^' is not an integer");
}
e.type = e.expr1.type;
}
#line 382 "output.c"
}
break;
case binary.KIND:
case plus.KIND:
case minus.KIND:
case multiply.KIND:
case divide.KIND:
{
binary e = (binary)e__;
#line 47 "output16.tst"
{
type_code type1, type2;
infer_type(e.expr1);
type1 = e.expr1.type;
infer_type(e.expr2);
type2 = e.expr2.type;
if(type1 == type_code.float_type ||
type_code.type2 == float_type)
{
e.type = type_code.float_type;
}
else
{
e.type = type_code.int_type;
}
}
#line 412 "output.c"
}
break;
case unary.KIND:
case negate.KIND:
{
unary e = (unary)e__;
#line 67 "output16.tst"
{
infer_type(e.expr);
e.type = e.expr.type;
}
#line 425 "output.c"
}
break;
case intnum.KIND:
{
intnum e = (intnum)e__;
#line 73 "output16.tst"
{
e.type = type_code.int_type;
}
#line 436 "output.c"
}
break;
default: break;
}
}
}
}
--- NEW FILE ---
// test output logic for "internal" classes.
%option lang = "C#"
%option namespace = "Test"
%option internal_access
%enum type_code =
{
int_type,
float_type
}
%node expression %abstract %typedef =
{
%nocreate type_code type = {type_code.int_type};
}
%node binary expression %abstract =
{
expression expr1;
expression expr2;
}
%node unary expression %abstract =
{
;
expression expr;
;
}
%node intnum expression =
{
int num;
}
%node plus binary
%node minus binary
%node multiply binary
%node divide binary
%node negate unary
%node power binary
%operation %inline void Infer::infer_type(expression e)
infer_type(binary)
{
type_code type1, type2;
infer_type(e.expr1);
type1 = e.expr1.type;
infer_type(e.expr2);
type2 = e.expr2.type;
if(type1 == type_code.float_type || type_code.type2 == float_type)
{
e.type = type_code.float_type;
}
else
{
e.type = type_code.int_type;
}
}
infer_type(unary)
{
infer_type(e.expr);
e.type = e.expr.type;
}
infer_type(intnum)
{
e.type = type_code.int_type;
}
infer_type(power)
{
infer_type(e.expr1);
infer_type(e.expr2);
if(e.expr2.type != type_code.int_type)
{
error("second sub-expression to `^' is not an integer");
}
e.type = e.expr1.type;
}
%operation %virtual void infer_virtual(expression e)
infer_virtual(binary)
{
type_code type1, type2;
e.expr1.infer_virtual();
type1 = e.expr1.type;
e.expr2.infer_virtual();
type2 = e.expr2.type;
if(type1 == type_code.float_type || type_code.type2 == float_type)
{
e.type = type_code.float_type;
}
else
{
e.type = type_code.int_type;
}
}
infer_virtual(unary)
{
e.expr.infer_virtual();
e.type = e.expr.type;
}
infer_virtual(intnum)
{
e.type = type_code.int_type;
}
infer_virtual(power)
{
e.expr1.infer_virtual();
e.expr2.infer_virtual();
if(e.expr2.type != type_code.int_type)
{
error("second sub-expression to `^' is not an integer");
}
e.type = e.expr1.type;
}
Index: test_list
===================================================================
RCS file: /cvsroot/dotgnu-pnet/treecc/tests/test_list,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** test_list 28 Dec 2001 04:56:06 -0000 1.3
--- test_list 30 Dec 2002 21:54:14 -0000 1.4
***************
*** 34,35 ****
--- 34,36 ----
test_output output14
test_output output15
+ test_output output16
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: treecc/tests output16.out,NONE,1.1 output16.tst,NONE,1.1 test_list,1.3,1.4,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnet ChangeLog,1.2036,1.2037
- Next by Date:
[Dotgnu-pnet-commits] CVS: treecc ChangeLog,1.64,1.65 gen_cs.c,1.2,1.3 gen_java.c,1.3,1.4 info.h,1.6,1.7 options.c,1.4,1.5
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnet ChangeLog,1.2036,1.2037
- Next by thread:
[Dotgnu-pnet-commits] CVS: treecc ChangeLog,1.64,1.65 gen_cs.c,1.2,1.3 gen_java.c,1.3,1.4 info.h,1.6,1.7 options.c,1.4,1.5
- Index(es):