Skip to content
Browse files

all type declarations work

  • Loading branch information...
1 parent 5546128 commit dcee81d92c02a754c54dcf0693a866acb4a2e7f8 @Swizec committed Apr 1, 2012
View
225 pascal/src/compiler/synanal/PascalSyn.java
@@ -1,7 +1,7 @@
//----------------------------------------------------
// The following code was generated by CUP v0.11a beta 20060608
-// Sun Apr 01 17:57:00 CEST 2012
+// Sun Apr 01 18:25:30 CEST 2012
//----------------------------------------------------
package compiler.synanal;
@@ -10,7 +10,7 @@
import compiler.report.*;
/** CUP v0.11a beta 20060608 generated parser.
- * @version Sun Apr 01 17:57:00 CEST 2012
+ * @version Sun Apr 01 18:25:30 CEST 2012
*/
public class PascalSyn extends java_cup.runtime.lr_parser {
@@ -26,78 +26,102 @@
/** Production table. */
protected static final short _production_table[][] =
unpackFromStrings(new String[] {
- "\000\031\000\002\002\004\000\002\002\006\000\002\003" +
+ "\000\040\000\002\002\004\000\002\002\006\000\002\003" +
"\002\000\002\003\005\000\002\004\002\000\002\004\004" +
"\000\002\004\004\000\002\005\004\000\002\006\005\000" +
- "\002\007\003\000\002\007\005\000\002\010\004\000\002" +
- "\011\006\000\002\011\007\000\002\013\003\000\002\013" +
- "\003\000\002\013\003\000\002\015\003\000\002\015\003" +
- "\000\002\015\003\000\002\016\012\000\002\012\005\000" +
- "\002\014\003\000\002\014\003\000\002\014\003" });
+ "\002\007\005\000\002\007\007\000\002\010\004\000\002" +
+ "\011\006\000\002\011\007\000\002\012\003\000\002\012" +
+ "\003\000\002\012\003\000\002\012\003\000\002\012\003" +
+ "\000\002\012\005\000\002\014\003\000\002\014\003\000" +
+ "\002\014\003\000\002\015\012\000\002\016\005\000\002" +
+ "\017\003\000\002\017\004\000\002\020\006\000\002\021" +
+ "\004\000\002\013\003\000\002\013\003\000\002\013\003" +
+ "" });
/** Access to production table. */
public short[][] production_table() {return _production_table;}
/** Parse-action table. */
protected static final short[][] _action_table =
unpackFromStrings(new String[] {
- "\000\061\000\012\051\uffff\052\uffff\063\006\067\uffff\001" +
+ "\000\100\000\012\051\uffff\052\uffff\063\006\067\uffff\001" +
"\002\000\010\051\ufffd\052\012\067\015\001\002\000\004" +
"\002\011\001\002\000\004\010\007\001\002\000\004\024" +
"\010\001\002\000\010\051\ufffe\052\ufffe\067\ufffe\001\002" +
- "\000\004\002\001\001\002\000\004\010\055\001\002\000" +
+ "\000\004\002\001\001\002\000\004\010\075\001\002\000" +
"\010\051\ufffd\052\012\067\015\001\002\000\010\051\ufffd" +
"\052\012\067\015\001\002\000\004\010\024\001\002\000" +
"\004\051\017\001\002\000\004\055\022\001\002\000\004" +
"\016\021\001\002\000\004\002\000\001\002\000\004\016" +
"\ufffa\001\002\000\010\051\ufff6\052\ufff6\067\ufff6\001\002" +
- "\000\004\030\025\001\002\000\014\010\030\011\031\012" +
- "\032\013\034\047\035\001\002\000\004\024\050\001\002" +
- "\000\004\024\ufff1\001\002\000\004\024\ufff2\001\002\000" +
- "\004\024\ufff0\001\002\000\004\024\uffef\001\002\000\004" +
- "\024\ufff3\001\002\000\004\024\uffee\001\002\000\004\020" +
- "\036\001\002\000\010\004\037\005\042\006\041\001\002" +
- "\000\012\015\uffeb\017\uffeb\022\uffeb\024\uffeb\001\002\000" +
- "\004\017\043\001\002\000\012\015\uffe9\017\uffe9\022\uffe9" +
- "\024\uffe9\001\002\000\012\015\uffea\017\uffea\022\uffea\024" +
- "\uffea\001\002\000\010\004\037\005\042\006\041\001\002" +
- "\000\004\022\045\001\002\000\004\061\046\001\002\000" +
- "\014\010\030\011\031\012\032\013\034\047\035\001\002" +
- "\000\004\024\uffed\001\002\000\012\010\024\051\ufff5\052" +
- "\ufff5\067\ufff5\001\002\000\010\051\ufff4\052\ufff4\067\ufff4" +
- "\001\002\000\004\051\ufffc\001\002\000\004\051\ufffb\001" +
- "\002\000\004\024\063\001\002\000\004\030\061\001\002" +
- "\000\006\015\057\024\ufff8\001\002\000\004\010\055\001" +
- "\002\000\004\024\ufff7\001\002\000\010\004\037\005\042" +
- "\006\041\001\002\000\006\015\uffec\024\uffec\001\002\000" +
- "\010\051\ufff9\052\ufff9\067\ufff9\001\002" });
+ "\000\004\030\025\001\002\000\022\010\037\011\030\012" +
+ "\042\013\026\021\027\042\035\047\031\064\032\001\002" +
+ "\000\006\023\uffeb\024\uffeb\001\002\000\022\010\037\011" +
+ "\030\012\042\013\026\021\027\042\035\047\031\064\032" +
+ "\001\002\000\006\023\uffed\024\uffed\001\002\000\004\020" +
+ "\056\001\002\000\004\010\050\001\002\000\006\023\ufff3" +
+ "\024\ufff3\001\002\000\004\024\044\001\002\000\022\010" +
+ "\037\011\030\012\042\013\026\021\027\042\035\047\031" +
+ "\064\032\001\002\000\006\023\ufff0\024\ufff0\001\002\000" +
+ "\006\023\ufff2\024\ufff2\001\002\000\006\023\ufff1\024\ufff1" +
+ "\001\002\000\006\023\uffef\024\uffef\001\002\000\006\023" +
+ "\uffec\024\uffec\001\002\000\006\023\uffe5\024\uffe5\001\002" +
+ "\000\012\010\024\051\ufff5\052\ufff5\067\ufff5\001\002\000" +
+ "\010\051\ufff4\052\ufff4\067\ufff4\001\002\000\006\010\050" +
+ "\055\uffe8\001\002\000\004\055\054\001\002\000\004\014" +
+ "\051\001\002\000\022\010\037\011\030\012\042\013\026" +
+ "\021\027\042\035\047\031\064\032\001\002\000\004\024" +
+ "\053\001\002\000\006\010\uffe6\055\uffe6\001\002\000\006" +
+ "\023\uffe9\024\uffe9\001\002\000\004\055\uffe7\001\002\000" +
+ "\010\004\057\005\062\006\061\001\002\000\012\015\uffe4" +
+ "\017\uffe4\022\uffe4\024\uffe4\001\002\000\004\017\063\001" +
+ "\002\000\012\015\uffe2\017\uffe2\022\uffe2\024\uffe2\001\002" +
+ "\000\012\015\uffe3\017\uffe3\022\uffe3\024\uffe3\001\002\000" +
+ "\010\004\057\005\062\006\061\001\002\000\004\022\065" +
+ "\001\002\000\004\061\066\001\002\000\022\010\037\011" +
+ "\030\012\042\013\026\021\027\042\035\047\031\064\032" +
+ "\001\002\000\006\023\uffea\024\uffea\001\002\000\004\023" +
+ "\071\001\002\000\006\023\uffee\024\uffee\001\002\000\004" +
+ "\051\ufffc\001\002\000\004\051\ufffb\001\002\000\004\024" +
+ "\102\001\002\000\004\030\076\001\002\000\010\004\057" +
+ "\005\062\006\061\001\002\000\006\015\100\024\ufff8\001" +
+ "\002\000\004\010\075\001\002\000\004\024\ufff7\001\002" +
+ "\000\010\051\ufff9\052\ufff9\067\ufff9\001\002" });
/** Access to parse-action table. */
public short[][] action_table() {return _action_table;}
/** <code>reduce_goto</code> table. */
protected static final short[][] _reduce_table =
unpackFromStrings(new String[] {
- "\000\061\000\006\002\004\003\003\001\001\000\010\004" +
+ "\000\100\000\006\002\004\003\003\001\001\000\010\004" +
"\015\006\013\010\012\001\001\000\002\001\001\000\002" +
"\001\001\000\002\001\001\000\002\001\001\000\002\001" +
- "\001\000\006\007\053\012\055\001\001\000\010\004\052" +
- "\006\013\010\012\001\001\000\010\004\051\006\013\010" +
- "\012\001\001\000\004\011\022\001\001\000\004\005\017" +
- "\001\001\000\002\001\001\000\002\001\001\000\002\001" +
- "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
- "\000\010\013\025\015\032\016\026\001\001\000\002\001" +
- "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
- "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
- "\002\001\001\000\004\014\037\001\001\000\002\001\001" +
+ "\001\000\004\007\073\001\001\000\010\004\072\006\013" +
+ "\010\012\001\001\000\010\004\071\006\013\010\012\001" +
+ "\001\000\004\011\022\001\001\000\004\005\017\001\001" +
"\000\002\001\001\000\002\001\001\000\002\001\001\000" +
- "\004\014\043\001\001\000\002\001\001\000\002\001\001" +
- "\000\010\013\046\015\032\016\026\001\001\000\002\001" +
- "\001\000\004\011\050\001\001\000\002\001\001\000\002" +
+ "\002\001\001\000\002\001\001\000\002\001\001\000\014" +
+ "\012\033\014\032\015\037\016\035\021\040\001\001\000" +
+ "\002\001\001\000\014\012\067\014\032\015\037\016\035" +
+ "\021\040\001\001\000\002\001\001\000\002\001\001\000" +
+ "\006\017\046\020\045\001\001\000\002\001\001\000\002" +
+ "\001\001\000\014\012\042\014\032\015\037\016\035\021" +
+ "\040\001\001\000\002\001\001\000\002\001\001\000\002" +
+ "\001\001\000\002\001\001\000\002\001\001\000\002\001" +
+ "\001\000\004\011\044\001\001\000\002\001\001\000\006" +
+ "\017\054\020\045\001\001\000\002\001\001\000\002\001" +
+ "\001\000\014\012\051\014\032\015\037\016\035\021\040" +
+ "\001\001\000\002\001\001\000\002\001\001\000\002\001" +
+ "\001\000\002\001\001\000\004\013\057\001\001\000\002" +
"\001\001\000\002\001\001\000\002\001\001\000\002\001" +
- "\001\000\002\001\001\000\006\007\057\012\055\001\001" +
- "\000\002\001\001\000\004\014\061\001\001\000\002\001" +
- "\001\000\002\001\001" });
+ "\001\000\004\013\063\001\001\000\002\001\001\000\002" +
+ "\001\001\000\014\012\066\014\032\015\037\016\035\021" +
+ "\040\001\001\000\002\001\001\000\002\001\001\000\002" +
+ "\001\001\000\002\001\001\000\002\001\001\000\002\001" +
+ "\001\000\002\001\001\000\004\013\076\001\001\000\002" +
+ "\001\001\000\004\007\100\001\001\000\002\001\001\000" +
+ "\002\001\001" });
/** Access to <code>reduce_goto</code> table. */
public short[][] reduce_table() {return _reduce_table;}
@@ -173,74 +197,137 @@ public void report_fatal_error(String message, Object info) throws Exception {
switch (CUP$PascalSyn$act_num)
{
/*. . . . . . . . . . . . . . . . . . . .*/
- case 24: // value ::= INT_CONST
+ case 31: // value ::= INT_CONST
+ {
+ Object RESULT =null;
+
+ CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("value",9, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
+ }
+ return CUP$PascalSyn$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 30: // value ::= CHAR_CONST
+ {
+ Object RESULT =null;
+
+ CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("value",9, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
+ }
+ return CUP$PascalSyn$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 29: // value ::= BOOL_CONST
+ {
+ Object RESULT =null;
+
+ CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("value",9, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
+ }
+ return CUP$PascalSyn$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 28: // type_pointer ::= PTR type_desc
+ {
+ Object RESULT =null;
+
+ CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("type_pointer",15, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.elementAt(CUP$PascalSyn$top-1)), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
+ }
+ return CUP$PascalSyn$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 27: // type_record_component ::= IDENTIFIER COLON type_desc SEMIC
+ {
+ Object RESULT =null;
+
+ CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("type_record_component",14, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.elementAt(CUP$PascalSyn$top-3)), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
+ }
+ return CUP$PascalSyn$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 26: // type_record_components ::= type_record_component type_record_components
+ {
+ Object RESULT =null;
+
+ CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("type_record_components",13, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.elementAt(CUP$PascalSyn$top-1)), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
+ }
+ return CUP$PascalSyn$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 25: // type_record_components ::= type_record_component
+ {
+ Object RESULT =null;
+
+ CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("type_record_components",13, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
+ }
+ return CUP$PascalSyn$result;
+
+ /*. . . . . . . . . . . . . . . . . . . .*/
+ case 24: // type_record ::= RECORD type_record_components END
{
Object RESULT =null;
- CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("value",10, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
+ CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("type_record",12, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.elementAt(CUP$PascalSyn$top-2)), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
}
return CUP$PascalSyn$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 23: // value ::= CHAR_CONST
+ case 23: // type_table ::= ARRAY LBRACKET value DOTS value RBRACKET OF type_desc
{
Object RESULT =null;
- CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("value",10, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
+ CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("type_table",11, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.elementAt(CUP$PascalSyn$top-7)), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
}
return CUP$PascalSyn$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 22: // value ::= BOOL_CONST
+ case 22: // type_atom ::= INT
{
Object RESULT =null;
- CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("value",10, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
+ CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("type_atom",10, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
}
return CUP$PascalSyn$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 21: // assignment ::= IDENTIFIER EQU value
+ case 21: // type_atom ::= CHAR
{
Object RESULT =null;
- CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("assignment",8, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.elementAt(CUP$PascalSyn$top-2)), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
+ CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("type_atom",10, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
}
return CUP$PascalSyn$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 20: // type_table ::= ARRAY LBRACKET value DOTS value RBRACKET OF type_desc
+ case 20: // type_atom ::= BOOL
{
Object RESULT =null;
- CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("type_table",12, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.elementAt(CUP$PascalSyn$top-7)), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
+ CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("type_atom",10, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
}
return CUP$PascalSyn$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 19: // type_atom ::= INT
+ case 19: // type_desc ::= LPARENTHESIS type_desc RPARENTHESIS
{
Object RESULT =null;
- CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("type_atom",11, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
+ CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("type_desc",8, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.elementAt(CUP$PascalSyn$top-2)), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
}
return CUP$PascalSyn$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 18: // type_atom ::= CHAR
+ case 18: // type_desc ::= type_pointer
{
Object RESULT =null;
- CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("type_atom",11, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
+ CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("type_desc",8, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
}
return CUP$PascalSyn$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 17: // type_atom ::= BOOL
+ case 17: // type_desc ::= type_record
{
Object RESULT =null;
- CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("type_atom",11, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
+ CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("type_desc",8, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
}
return CUP$PascalSyn$result;
@@ -249,7 +336,7 @@ public void report_fatal_error(String message, Object info) throws Exception {
{
Object RESULT =null;
- CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("type_desc",9, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
+ CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("type_desc",8, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
}
return CUP$PascalSyn$result;
@@ -258,7 +345,7 @@ public void report_fatal_error(String message, Object info) throws Exception {
{
Object RESULT =null;
- CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("type_desc",9, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
+ CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("type_desc",8, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
}
return CUP$PascalSyn$result;
@@ -267,7 +354,7 @@ public void report_fatal_error(String message, Object info) throws Exception {
{
Object RESULT =null;
- CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("type_desc",9, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
+ CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("type_desc",8, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
}
return CUP$PascalSyn$result;
@@ -299,20 +386,20 @@ public void report_fatal_error(String message, Object info) throws Exception {
return CUP$PascalSyn$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 10: // constant_ ::= assignment COMMA constant_
+ case 10: // constant_ ::= IDENTIFIER EQU value COMMA constant_
{
Object RESULT =null;
- CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("constant_",5, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.elementAt(CUP$PascalSyn$top-2)), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
+ CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("constant_",5, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.elementAt(CUP$PascalSyn$top-4)), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
}
return CUP$PascalSyn$result;
/*. . . . . . . . . . . . . . . . . . . .*/
- case 9: // constant_ ::= assignment
+ case 9: // constant_ ::= IDENTIFIER EQU value
{
Object RESULT =null;
- CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("constant_",5, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
+ CUP$PascalSyn$result = parser.getSymbolFactory().newSymbol("constant_",5, ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.elementAt(CUP$PascalSyn$top-2)), ((java_cup.runtime.Symbol)CUP$PascalSyn$stack.peek()), RESULT);
}
return CUP$PascalSyn$result;
View
15 pascal/src/compiler/synanal/PascalTok.java
@@ -1,7 +1,7 @@
//----------------------------------------------------
// The following code was generated by CUP v0.11a beta 20060608
-// Sun Apr 01 17:57:00 CEST 2012
+// Sun Apr 01 18:25:30 CEST 2012
//----------------------------------------------------
package compiler.synanal;
@@ -68,17 +68,20 @@
/* non terminals */
static final int source = 0;
- static final int assignment = 8;
+ static final int type_record_component = 14;
static final int declaration = 2;
+ static final int type_record_components = 13;
static final int program = 1;
static final int type_ = 7;
static final int sentence = 3;
- static final int type_atom = 11;
- static final int type_desc = 9;
+ static final int type_atom = 10;
+ static final int type_desc = 8;
static final int constant = 4;
static final int type = 6;
- static final int type_table = 12;
- static final int value = 10;
+ static final int type_record = 12;
+ static final int type_table = 11;
+ static final int type_pointer = 15;
+ static final int value = 9;
static final int constant_ = 5;
}
View
13 pascal/src/compiler/synanal/pascal.cup
@@ -29,8 +29,8 @@ terminal ARRAY, ASSIGN, BEGIN, CONST, DO, ELSE, END, FOR, FUNCTION, IF, OF, PROC
non terminal source;
non terminal program, declaration, sentence;
non terminal constant, constant_, type, type_;
-non terminal assignment, type_desc, value;
-non terminal type_atom, type_table;
+non terminal type_desc, value;
+non terminal type_atom, type_table, type_record, type_record_components, type_record_component, type_pointer;
start with source;
@@ -44,13 +44,16 @@ sentence ::= BEGIN END;
declarations
*/
constant ::= CONST constant_ SEMIC;
-constant_ ::= assignment | assignment COMMA constant_;
+constant_ ::= IDENTIFIER EQU value | IDENTIFIER EQU value COMMA constant_;
/* types */
type ::= TYPE type_;
type_ ::= IDENTIFIER EQU type_desc SEMIC | IDENTIFIER EQU type_desc SEMIC type_;
-type_desc ::= type_atom | IDENTIFIER | type_table;
+type_desc ::= type_atom | IDENTIFIER | type_table | type_record | type_pointer | LPARENTHESIS type_desc RPARENTHESIS;
type_atom ::= BOOL | CHAR | INT;
type_table ::= ARRAY LBRACKET value DOTS value RBRACKET OF type_desc;
+type_record ::= RECORD type_record_components END;
+type_record_components ::= type_record_component | type_record_component type_record_components;
+type_record_component ::= IDENTIFIER COLON type_desc SEMIC;
+type_pointer ::= PTR type_desc;
-assignment ::= IDENTIFIER EQU value;
value ::= BOOL_CONST | CHAR_CONST | INT_CONST;
View
6 test/syntax.pascal
@@ -10,6 +10,12 @@ type
c = a;
d = array[2..5] of integer;
e = array[1..3] of d;
+ f = record
+ f : integer;
+ g : e;
+ end;
+ h = ^f;
+ i = (integer);
begin
end.

0 comments on commit dcee81d

Please sign in to comment.
Something went wrong with that request. Please try again.