CSC448: Parsing: Clogs AST: Exp [13/26] |
file:Exp.java [source] [doc-public] [doc-private]
00001: package clogs.ast; 00002: 00003: import clogs.util.Optional; 00004: 00005: 00006: public abstract class Exp 00007: { 00008: public final Optional<Type> to; 00009: 00010: 00011: Exp (Optional<Type> to) 00012: { 00013: clogs.util.NonNull.check (to); 00014: this.to = to; 00015: } 00016: 00017: 00018: public abstract Exp setType (Type type); 00019: 00020: 00021: public String toString () 00022: { 00023: PrettyPrinter pp = new PrettyPrinter (); 00024: pp.printExp (this); 00025: return pp.toString (); 00026: } 00027: } 00028:
file:ExpArrayAccess.java [source] [doc-public] [doc-private]
00001: package clogs.ast; 00002: 00003: import clogs.util.Optional; 00004: 00005: 00006: public class ExpArrayAccess extends Exp 00007: { 00008: public final Exp array; 00009: public final Exp index; 00010: 00011: 00012: public ExpArrayAccess (Exp array, Exp index) 00013: { 00014: this (new Optional<Type> (), array, index); 00015: } 00016: 00017: 00018: ExpArrayAccess (Optional<Type> to, Exp array, Exp index) 00019: { 00020: super (to); 00021: clogs.util.NonNull.check (array, index); 00022: this.array = array; 00023: this.index = index; 00024: } 00025: 00026: 00027: public Exp setType (Type type) 00028: { 00029: return new ExpArrayAccess (new Optional<Type> (type), array, index); 00030: } 00031: } 00032:
file:ExpAssign.java [source] [doc-public] [doc-private]
00001: package clogs.ast; 00002: 00003: import clogs.util.Optional; 00004: 00005: 00006: public class ExpAssign extends Exp 00007: { 00008: public final Exp left; 00009: public final Exp right; 00010: 00011: 00012: public ExpAssign (Exp left, Exp right) 00013: { 00014: this (new Optional<Type> (), left, right); 00015: } 00016: 00017: 00018: ExpAssign (Optional<Type> to, Exp left, Exp right) 00019: { 00020: super (to); 00021: clogs.util.NonNull.check (left, right); 00022: this.left = left; 00023: this.right = right; 00024: } 00025: 00026: 00027: public Exp setType (Type type) 00028: { 00029: return new ExpAssign (new Optional<Type> (type), left, right); 00030: } 00031: } 00032:
file:ExpBinOp.java [source] [doc-public] [doc-private]
00001: package clogs.ast; 00002: 00003: import clogs.util.Optional; 00004: 00005: 00006: public class ExpBinOp extends Exp 00007: { 00008: public enum BinOp { 00009: PLUS ("+"), 00010: MINUS ("-"), 00011: TIMES ("*"), 00012: DIVIDE ("/"), 00013: MOD ("%"), 00014: LESSTHAN ("<"), 00015: GREATERTHAN (">"), 00016: LEQ ("<="), 00017: GEQ (">="), 00018: EQUALSEQUALS ("=="), 00019: BANGEQUALS ("!="), 00020: AMP ("&"), 00021: CARET ("^"), 00022: BAR ("|"), 00023: AMPAMP ("&&"), 00024: BARBAR ("||"); 00025: 00026: final String string; 00027: 00028: BinOp (String string) 00029: { 00030: this.string = string; 00031: } 00032: 00033: public String toString () 00034: { 00035: return string; 00036: } 00037: }; 00038: 00039: 00040: public final BinOp op; 00041: public final Exp left; 00042: public final Exp right; 00043: 00044: 00045: public ExpBinOp (BinOp op, Exp left, Exp right) 00046: { 00047: this (new Optional<Type> (), op, left, right); 00048: } 00049: 00050: 00051: ExpBinOp (Optional<Type> to, BinOp op, Exp left, Exp right) 00052: { 00053: super (to); 00054: clogs.util.NonNull.check (op, left, right); 00055: this.op = op; 00056: this.left = left; 00057: this.right = right; 00058: } 00059: 00060: 00061: public Exp setType (Type type) 00062: { 00063: return new ExpBinOp (new Optional<Type> (type), op, left, right); 00064: } 00065: } 00066:
file:ExpComma.java [source] [doc-public] [doc-private]
00001: package clogs.ast; 00002: 00003: import clogs.util.Optional; 00004: 00005: 00006: public class ExpComma extends Exp 00007: { 00008: public final Exp left; 00009: public final Exp right; 00010: 00011: 00012: public ExpComma (Exp left, Exp right) 00013: { 00014: this (new Optional<Type> (), left, right); 00015: } 00016: 00017: 00018: ExpComma (Optional<Type> to, Exp left, Exp right) 00019: { 00020: super (to); 00021: clogs.util.NonNull.check (left, right); 00022: this.left = left; 00023: this.right = right; 00024: } 00025: 00026: 00027: public Exp setType (Type type) 00028: { 00029: return new ExpComma (new Optional<Type> (type), left, right); 00030: } 00031: } 00032:
file:ExpFunCall.java [source] [doc-public] [doc-private]
00001: package clogs.ast; 00002: 00003: import clogs.util.List; 00004: import clogs.util.Optional; 00005: 00006: 00007: public class ExpFunCall extends Exp 00008: { 00009: public final String name; 00010: public final List<Exp> args; 00011: 00012: 00013: public ExpFunCall (String name, List<Exp> args) 00014: { 00015: this (new Optional<Type> (), name, args); 00016: } 00017: 00018: 00019: ExpFunCall (Optional<Type> to, String name, List<Exp> args) 00020: { 00021: super (to); 00022: clogs.util.NonNull.check (name, args); 00023: this.name = name; 00024: this.args = args; 00025: } 00026: 00027: 00028: public Exp setType (Type type) 00029: { 00030: return new ExpFunCall (new Optional<Type> (type), name, args); 00031: } 00032: } 00033:
file:ExpInt.java [source] [doc-public] [doc-private]
00001: package clogs.ast; 00002: 00003: import clogs.util.Optional; 00004: 00005: 00006: public class ExpInt extends Exp 00007: { 00008: public final int value; 00009: 00010: 00011: public ExpInt (int value) 00012: { 00013: this (new Optional<Type> (), value); 00014: } 00015: 00016: 00017: ExpInt (Optional<Type> to, int value) 00018: { 00019: super (to); 00020: this.value = value; 00021: } 00022: 00023: 00024: public Exp setType (Type type) 00025: { 00026: return new ExpInt (new Optional<Type> (type), value); 00027: } 00028: } 00029:
file:ExpNew.java [source] [doc-public] [doc-private]
00001: package clogs.ast; 00002: 00003: import clogs.util.Optional; 00004: 00005: 00006: public class ExpNew extends Exp 00007: { 00008: public final Type contentType; 00009: public final Exp size; 00010: 00011: 00012: public ExpNew (Type contentType, Exp size) 00013: { 00014: this (new Optional<Type> (), contentType, size); 00015: } 00016: 00017: 00018: ExpNew (Optional<Type> to, Type contentType, Exp size) 00019: { 00020: super (to); 00021: this.contentType = contentType; 00022: this.size = size; 00023: } 00024: 00025: 00026: public Exp setType (Type type) 00027: { 00028: return new ExpNew (new Optional<Type> (type), contentType, size); 00029: } 00030: } 00031:
file:ExpString.java [source] [doc-public] [doc-private]
00001: package clogs.ast; 00002: 00003: import clogs.util.Optional; 00004: 00005: 00006: public class ExpString extends Exp 00007: { 00008: public final String value; 00009: 00010: 00011: public ExpString (String value) 00012: { 00013: this (new Optional<Type> (), value); 00014: } 00015: 00016: 00017: ExpString (Optional<Type> to, String value) 00018: { 00019: super (to); 00020: this.value = value; 00021: } 00022: 00023: 00024: public Exp setType (Type type) 00025: { 00026: return new ExpString (new Optional<Type> (type), value); 00027: } 00028: } 00029:
file:ExpUnOp.java [source] [doc-public] [doc-private]
00001: package clogs.ast; 00002: 00003: import clogs.util.Optional; 00004: 00005: 00006: public class ExpUnOp extends Exp 00007: { 00008: public enum UnOp { 00009: MINUS ("-"), 00010: BANG ("!"); 00011: 00012: final String string; 00013: 00014: UnOp (String string) 00015: { 00016: this.string = string; 00017: } 00018: 00019: public String toString () 00020: { 00021: return string; 00022: } 00023: }; 00024: 00025: public final UnOp op; 00026: public final Exp exp; 00027: 00028: 00029: public ExpUnOp (UnOp op, Exp exp) 00030: { 00031: this (new Optional<Type> (), op, exp); 00032: } 00033: 00034: 00035: ExpUnOp (Optional<Type> to, UnOp op, Exp exp) 00036: { 00037: super (to); 00038: clogs.util.NonNull.check (op, exp); 00039: this.op = op; 00040: this.exp = exp; 00041: } 00042: 00043: 00044: public Exp setType (Type type) 00045: { 00046: return new ExpUnOp (new Optional<Type> (type), op, exp); 00047: } 00048: } 00049:
file:ExpVar.java [source] [doc-public] [doc-private]
00001: package clogs.ast; 00002: 00003: import clogs.util.Optional; 00004: 00005: 00006: public class ExpVar extends Exp 00007: { 00008: public final String name; 00009: 00010: 00011: public ExpVar (String name) 00012: { 00013: this (new Optional<Type> (), name); 00014: } 00015: 00016: 00017: ExpVar (Optional<Type> to, String name) 00018: { 00019: super (to); 00020: this.name = name; 00021: } 00022: 00023: 00024: public Exp setType (Type type) 00025: { 00026: return new ExpVar (new Optional<Type> (type), name); 00027: } 00028: } 00029: