Renamed packages to match Java guidelines.

This commit is contained in:
Deryck Brown
2022-05-22 14:15:46 +01:00
parent 55f6b2d105
commit bffeafba10
138 changed files with 856 additions and 856 deletions
@@ -0,0 +1,34 @@
/*
* @(#)AST.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees;
import triangle.codeGenerator.entities.RuntimeEntity;
import triangle.syntacticAnalyzer.SourcePosition;
public abstract class AbstractSyntaxTree {
private final SourcePosition position;
public AbstractSyntaxTree(SourcePosition position) {
this.position = position;
entity = null;
}
public SourcePosition getPosition() {
return position;
}
public RuntimeEntity entity;
}
@@ -0,0 +1,37 @@
/*
* @(#)Program.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees;
import triangle.abstractSyntaxTrees.commands.Command;
import triangle.abstractSyntaxTrees.visitors.ProgramVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class Program extends AbstractSyntaxTree {
public Program(Command cAST, SourcePosition position) {
super(position);
C = cAST;
}
public Command C;
public <TArg, TResult> TResult visit(ProgramVisitor<TArg, TResult> visitor, TArg arg) {
return visitor.visitProgram(this, arg);
}
public <TResult> TResult visit(ProgramVisitor<Void, TResult> visitor) {
return visit(visitor, null);
}
}
@@ -0,0 +1,32 @@
/*
* @(#)ActualParameter.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.actuals;
import triangle.abstractSyntaxTrees.AbstractSyntaxTree;
import triangle.abstractSyntaxTrees.visitors.ActualParameterVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public abstract class ActualParameter extends AbstractSyntaxTree {
public ActualParameter(SourcePosition position) {
super(position);
}
public abstract <TArg, TResult> TResult visit(ActualParameterVisitor<TArg, TResult> visitor, TArg arg);
public <TArg, TResult> TResult visit(ActualParameterVisitor<TArg, TResult> visitor) {
return visit(visitor, null);
}
}
@@ -0,0 +1,32 @@
/*
* @(#)ActualParameterSequence.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.actuals;
import triangle.abstractSyntaxTrees.AbstractSyntaxTree;
import triangle.abstractSyntaxTrees.visitors.ActualParameterSequenceVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public abstract class ActualParameterSequence extends AbstractSyntaxTree {
public ActualParameterSequence(SourcePosition position) {
super(position);
}
public abstract <TArg, TResult> TResult visit(ActualParameterSequenceVisitor<TArg, TResult> v, TArg arg);
public <TResult> TResult visit(ActualParameterSequenceVisitor<Void, TResult> v) {
return visit(v, null);
}
}
@@ -0,0 +1,33 @@
/*
* @(#)ConstActualParameter.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.actuals;
import triangle.abstractSyntaxTrees.expressions.Expression;
import triangle.abstractSyntaxTrees.visitors.ActualParameterVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class ConstActualParameter extends ActualParameter {
public ConstActualParameter(Expression eAST, SourcePosition position) {
super(position);
E = eAST;
}
public <TArg, TResult> TResult visit(ActualParameterVisitor<TArg, TResult> v, TArg arg) {
return v.visitConstActualParameter(this, arg);
}
public final Expression E;
}
@@ -0,0 +1,29 @@
/*
* @(#)EmptyActualParameterSequence.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.actuals;
import triangle.abstractSyntaxTrees.visitors.ActualParameterSequenceVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class EmptyActualParameterSequence extends ActualParameterSequence {
public EmptyActualParameterSequence(SourcePosition position) {
super(position);
}
public <TArg, TResult> TResult visit(ActualParameterSequenceVisitor<TArg, TResult> v, TArg arg) {
return v.visitEmptyActualParameterSequence(this, arg);
}
}
@@ -0,0 +1,33 @@
/*
* @(#)FuncActualParameter.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.actuals;
import triangle.abstractSyntaxTrees.terminals.Identifier;
import triangle.abstractSyntaxTrees.visitors.ActualParameterVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class FuncActualParameter extends ActualParameter {
public FuncActualParameter(Identifier iAST, SourcePosition position) {
super(position);
I = iAST;
}
public <TArg, TResult> TResult visit(ActualParameterVisitor<TArg, TResult> v, TArg arg) {
return v.visitFuncActualParameter(this, arg);
}
public final Identifier I;
}
@@ -0,0 +1,35 @@
/*
* @(#)MultipleActualParameterSequence.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.actuals;
import triangle.abstractSyntaxTrees.visitors.ActualParameterSequenceVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class MultipleActualParameterSequence extends ActualParameterSequence {
public MultipleActualParameterSequence(ActualParameter apAST, ActualParameterSequence apsAST,
SourcePosition position) {
super(position);
AP = apAST;
APS = apsAST;
}
public <TArg, TResult> TResult visit(ActualParameterSequenceVisitor<TArg, TResult> v, TArg arg) {
return v.visitMultipleActualParameterSequence(this, arg);
}
public final ActualParameter AP;
public final ActualParameterSequence APS;
}
@@ -0,0 +1,33 @@
/*
* @(#)ProcActualParameter.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.actuals;
import triangle.abstractSyntaxTrees.terminals.Identifier;
import triangle.abstractSyntaxTrees.visitors.ActualParameterVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class ProcActualParameter extends ActualParameter {
public ProcActualParameter(Identifier iAST, SourcePosition position) {
super(position);
I = iAST;
}
public <TArg, TResult> TResult visit(ActualParameterVisitor<TArg, TResult> v, TArg arg) {
return v.visitProcActualParameter(this, arg);
}
public final Identifier I;
}
@@ -0,0 +1,32 @@
/*
* @(#)SingleActualParameterSequence.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.actuals;
import triangle.abstractSyntaxTrees.visitors.ActualParameterSequenceVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class SingleActualParameterSequence extends ActualParameterSequence {
public SingleActualParameterSequence(ActualParameter apAST, SourcePosition position) {
super(position);
AP = apAST;
}
public <TArg, TResult> TResult visit(ActualParameterSequenceVisitor<TArg, TResult> v, TArg arg) {
return v.visitSingleActualParameterSequence(this, arg);
}
public final ActualParameter AP;
}
@@ -0,0 +1,33 @@
/*
* @(#)VarActualParameter.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.actuals;
import triangle.abstractSyntaxTrees.visitors.ActualParameterVisitor;
import triangle.abstractSyntaxTrees.vnames.Vname;
import triangle.syntacticAnalyzer.SourcePosition;
public class VarActualParameter extends ActualParameter {
public VarActualParameter(Vname vAST, SourcePosition position) {
super(position);
V = vAST;
}
public <TArg, TResult> TResult visit(ActualParameterVisitor<TArg, TResult> v, TArg arg) {
return v.visitVarActualParameter(this, arg);
}
public final Vname V;
}
@@ -0,0 +1,35 @@
/*
* @(#)ArrayAggregate.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.aggregates;
import triangle.abstractSyntaxTrees.AbstractSyntaxTree;
import triangle.abstractSyntaxTrees.visitors.ArrayAggregateVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public abstract class ArrayAggregate extends AbstractSyntaxTree {
public ArrayAggregate(SourcePosition position) {
super(position);
elemCount = 0;
}
public int elemCount;
public abstract <TArg, TResult> TResult visit(ArrayAggregateVisitor<TArg, TResult> visitor, TArg arg);
public <TArg, TResult> TResult visit(ArrayAggregateVisitor<TArg, TResult> visitor) {
return visit(visitor, null);
}
}
@@ -0,0 +1,35 @@
/*
* @(#)MultipleArrayAggregate.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.aggregates;
import triangle.abstractSyntaxTrees.expressions.Expression;
import triangle.abstractSyntaxTrees.visitors.ArrayAggregateVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class MultipleArrayAggregate extends ArrayAggregate {
public MultipleArrayAggregate(Expression eAST, ArrayAggregate aaAST, SourcePosition position) {
super(position);
E = eAST;
AA = aaAST;
}
public <TArg, TResult> TResult visit(ArrayAggregateVisitor<TArg, TResult> v, TArg arg) {
return v.visitMultipleArrayAggregate(this, arg);
}
public final Expression E;
public final ArrayAggregate AA;
}
@@ -0,0 +1,38 @@
/*
* @(#)MultipleRecordAggregate.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.aggregates;
import triangle.abstractSyntaxTrees.expressions.Expression;
import triangle.abstractSyntaxTrees.terminals.Identifier;
import triangle.abstractSyntaxTrees.visitors.RecordAggregateVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class MultipleRecordAggregate extends RecordAggregate {
public MultipleRecordAggregate(Identifier iAST, Expression eAST, RecordAggregate raAST, SourcePosition position) {
super(position);
I = iAST;
E = eAST;
RA = raAST;
}
public <TArg, TResult> TResult visit(RecordAggregateVisitor<TArg, TResult> v, TArg arg) {
return v.visitMultipleRecordAggregate(this, arg);
}
public final Identifier I;
public final Expression E;
public final RecordAggregate RA;
}
@@ -0,0 +1,36 @@
/*
* @(#)RecordAggregate.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.aggregates;
import triangle.abstractSyntaxTrees.AbstractSyntaxTree;
import triangle.abstractSyntaxTrees.types.FieldTypeDenoter;
import triangle.abstractSyntaxTrees.visitors.RecordAggregateVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public abstract class RecordAggregate extends AbstractSyntaxTree {
public RecordAggregate(SourcePosition position) {
super(position);
type = null;
}
public FieldTypeDenoter type;
public abstract <TArg, TResult> TResult visit(RecordAggregateVisitor<TArg, TResult> visitor, TArg arg);
public <TArg, TResult> TResult visit(RecordAggregateVisitor<TArg, TResult> visitor) {
return visit(visitor, null);
}
}
@@ -0,0 +1,33 @@
/*
* @(#)SingleArrayAggregate.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.aggregates;
import triangle.abstractSyntaxTrees.expressions.Expression;
import triangle.abstractSyntaxTrees.visitors.ArrayAggregateVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class SingleArrayAggregate extends ArrayAggregate {
public SingleArrayAggregate(Expression eAST, SourcePosition position) {
super(position);
E = eAST;
}
public <TArg, TResult> TResult visit(ArrayAggregateVisitor<TArg, TResult> v, TArg arg) {
return v.visitSingleArrayAggregate(this, arg);
}
public final Expression E;
}
@@ -0,0 +1,36 @@
/*
* @(#)SingleRecordAggregate.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.aggregates;
import triangle.abstractSyntaxTrees.expressions.Expression;
import triangle.abstractSyntaxTrees.terminals.Identifier;
import triangle.abstractSyntaxTrees.visitors.RecordAggregateVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class SingleRecordAggregate extends RecordAggregate {
public SingleRecordAggregate(Identifier iAST, Expression eAST, SourcePosition position) {
super(position);
I = iAST;
E = eAST;
}
public <TArg, TResult> TResult visit(RecordAggregateVisitor<TArg, TResult> v, TArg arg) {
return v.visitSingleRecordAggregate(this, arg);
}
public final Identifier I;
public final Expression E;
}
@@ -0,0 +1,36 @@
/*
* @(#)AssignCommand.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.commands;
import triangle.abstractSyntaxTrees.expressions.Expression;
import triangle.abstractSyntaxTrees.visitors.CommandVisitor;
import triangle.abstractSyntaxTrees.vnames.Vname;
import triangle.syntacticAnalyzer.SourcePosition;
public class AssignCommand extends Command {
public AssignCommand(Vname vAST, Expression eAST, SourcePosition position) {
super(position);
V = vAST;
E = eAST;
}
public <TArg, TResult> TResult visit(CommandVisitor<TArg, TResult> v, TArg arg) {
return v.visitAssignCommand(this, arg);
}
public final Vname V;
public final Expression E;
}
@@ -0,0 +1,36 @@
/*
* @(#)CallCommand.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.commands;
import triangle.abstractSyntaxTrees.actuals.ActualParameterSequence;
import triangle.abstractSyntaxTrees.terminals.Identifier;
import triangle.abstractSyntaxTrees.visitors.CommandVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class CallCommand extends Command {
public CallCommand(Identifier iAST, ActualParameterSequence apsAST, SourcePosition position) {
super(position);
I = iAST;
APS = apsAST;
}
public <TArg, TResult> TResult visit(CommandVisitor<TArg, TResult> v, TArg arg) {
return v.visitCallCommand(this, arg);
}
public final Identifier I;
public final ActualParameterSequence APS;
}
@@ -0,0 +1,32 @@
/*
* @(#)Command.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.commands;
import triangle.abstractSyntaxTrees.AbstractSyntaxTree;
import triangle.abstractSyntaxTrees.visitors.CommandVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public abstract class Command extends AbstractSyntaxTree {
public Command(SourcePosition position) {
super(position);
}
public abstract <TArg, TResult> TResult visit(CommandVisitor<TArg, TResult> visitor, TArg arg);
public <TArg, TResult> TResult visit(CommandVisitor<TArg, TResult> visitor) {
return visit(visitor, null);
}
}
@@ -0,0 +1,29 @@
/*
* @(#)EmptyCommand.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.commands;
import triangle.abstractSyntaxTrees.visitors.CommandVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class EmptyCommand extends Command {
public EmptyCommand(SourcePosition position) {
super(position);
}
public <TArg, TResult> TResult visit(CommandVisitor<TArg, TResult> v, TArg arg) {
return v.visitEmptyCommand(this, arg);
}
}
@@ -0,0 +1,36 @@
/*
* @(#)IfCommand.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.commands;
import triangle.abstractSyntaxTrees.expressions.Expression;
import triangle.abstractSyntaxTrees.visitors.CommandVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class IfCommand extends Command {
public IfCommand(Expression eAST, Command c1AST, Command c2AST, SourcePosition position) {
super(position);
E = eAST;
C1 = c1AST;
C2 = c2AST;
}
public <TArg, TResult> TResult visit(CommandVisitor<TArg, TResult> v, TArg arg) {
return v.visitIfCommand(this, arg);
}
public final Expression E;
public final Command C1, C2;
}
@@ -0,0 +1,35 @@
/*
* @(#)LetCommand.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.commands;
import triangle.abstractSyntaxTrees.declarations.Declaration;
import triangle.abstractSyntaxTrees.visitors.CommandVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class LetCommand extends Command {
public LetCommand(Declaration dAST, Command cAST, SourcePosition position) {
super(position);
D = dAST;
C = cAST;
}
public <TArg, TResult> TResult visit(CommandVisitor<TArg, TResult> v, TArg arg) {
return v.visitLetCommand(this, arg);
}
public final Declaration D;
public final Command C;
}
@@ -0,0 +1,33 @@
/*
* @(#)SequentialCommand.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.commands;
import triangle.abstractSyntaxTrees.visitors.CommandVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class SequentialCommand extends Command {
public SequentialCommand(Command c1AST, Command c2AST, SourcePosition position) {
super(position);
C1 = c1AST;
C2 = c2AST;
}
public <TArg, TResult> TResult visit(CommandVisitor<TArg, TResult> v, TArg arg) {
return v.visitSequentialCommand(this, arg);
}
public final Command C1, C2;
}
@@ -0,0 +1,35 @@
/*
* @(#)WhileCommand.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.commands;
import triangle.abstractSyntaxTrees.expressions.Expression;
import triangle.abstractSyntaxTrees.visitors.CommandVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class WhileCommand extends Command {
public WhileCommand(Expression eAST, Command cAST, SourcePosition position) {
super(position);
E = eAST;
C = cAST;
}
public <TArg, TResult> TResult visit(CommandVisitor<TArg, TResult> v, TArg arg) {
return v.visitWhileCommand(this, arg);
}
public final Expression E;
public final Command C;
}
@@ -0,0 +1,39 @@
/*
* @(#)BinaryOperatorDeclaration.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.declarations;
import triangle.abstractSyntaxTrees.terminals.Operator;
import triangle.abstractSyntaxTrees.types.TypeDenoter;
import triangle.abstractSyntaxTrees.visitors.DeclarationVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class BinaryOperatorDeclaration extends Declaration {
public BinaryOperatorDeclaration(Operator oAST, TypeDenoter arg1AST, TypeDenoter arg2AST, TypeDenoter resultAST,
SourcePosition position) {
super(position);
O = oAST;
ARG1 = arg1AST;
ARG2 = arg2AST;
RES = resultAST;
}
public <TArg, TResult> TResult visit(DeclarationVisitor<TArg, TResult> v, TArg arg) {
return v.visitBinaryOperatorDeclaration(this, arg);
}
public final Operator O;
public final TypeDenoter ARG1, ARG2, RES;
}
@@ -0,0 +1,36 @@
/*
* @(#)ConstDeclaration.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.declarations;
import triangle.abstractSyntaxTrees.expressions.Expression;
import triangle.abstractSyntaxTrees.terminals.Identifier;
import triangle.abstractSyntaxTrees.visitors.DeclarationVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class ConstDeclaration extends Declaration {
public ConstDeclaration(Identifier iAST, Expression eAST, SourcePosition position) {
super(position);
I = iAST;
E = eAST;
}
public <TArg, TResult> TResult visit(DeclarationVisitor<TArg, TResult> v, TArg arg) {
return v.visitConstDeclaration(this, arg);
}
public final Identifier I;
public final Expression E;
}
@@ -0,0 +1,35 @@
/*
* @(#)Declaration.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.declarations;
import triangle.abstractSyntaxTrees.AbstractSyntaxTree;
import triangle.abstractSyntaxTrees.visitors.DeclarationVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public abstract class Declaration extends AbstractSyntaxTree {
public Declaration(SourcePosition position) {
super(position);
duplicated = false;
}
public boolean duplicated;
public abstract <TArg, TResult> TResult visit(DeclarationVisitor<TArg, TResult> visitor, TArg arg);
public <TArg, TResult> TResult visit(DeclarationVisitor<TArg, TResult> visitor) {
return visit(visitor, null);
}
}
@@ -0,0 +1,43 @@
/*
* @(#)FuncDeclaration.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.declarations;
import triangle.abstractSyntaxTrees.expressions.Expression;
import triangle.abstractSyntaxTrees.formals.FormalParameterSequence;
import triangle.abstractSyntaxTrees.terminals.Identifier;
import triangle.abstractSyntaxTrees.types.TypeDenoter;
import triangle.abstractSyntaxTrees.visitors.DeclarationVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class FuncDeclaration extends Declaration {
public FuncDeclaration(Identifier iAST, FormalParameterSequence fpsAST, TypeDenoter tAST, Expression eAST,
SourcePosition position) {
super(position);
I = iAST;
FPS = fpsAST;
T = tAST;
E = eAST;
}
public <TArg, TResult> TResult visit(DeclarationVisitor<TArg, TResult> v, TArg arg) {
return v.visitFuncDeclaration(this, arg);
}
public final Identifier I;
public final FormalParameterSequence FPS;
public TypeDenoter T;
public final Expression E;
}
@@ -0,0 +1,39 @@
/*
* @(#)ProcDeclaration.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.declarations;
import triangle.abstractSyntaxTrees.commands.Command;
import triangle.abstractSyntaxTrees.formals.FormalParameterSequence;
import triangle.abstractSyntaxTrees.terminals.Identifier;
import triangle.abstractSyntaxTrees.visitors.DeclarationVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class ProcDeclaration extends Declaration {
public ProcDeclaration(Identifier iAST, FormalParameterSequence fpsAST, Command cAST, SourcePosition position) {
super(position);
I = iAST;
FPS = fpsAST;
C = cAST;
}
public <TArg, TResult> TResult visit(DeclarationVisitor<TArg, TResult> v, TArg arg) {
return v.visitProcDeclaration(this, arg);
}
public final Identifier I;
public final FormalParameterSequence FPS;
public final Command C;
}
@@ -0,0 +1,33 @@
/*
* @(#)SequentialDeclaration.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.declarations;
import triangle.abstractSyntaxTrees.visitors.DeclarationVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class SequentialDeclaration extends Declaration {
public SequentialDeclaration(Declaration d1AST, Declaration d2AST, SourcePosition position) {
super(position);
D1 = d1AST;
D2 = d2AST;
}
public <TArg, TResult> TResult visit(DeclarationVisitor<TArg, TResult> v, TArg arg) {
return v.visitSequentialDeclaration(this, arg);
}
public final Declaration D1, D2;
}
@@ -0,0 +1,37 @@
/*
* @(#)UnaryOperatorDeclaration.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.declarations;
import triangle.abstractSyntaxTrees.terminals.Operator;
import triangle.abstractSyntaxTrees.types.TypeDenoter;
import triangle.abstractSyntaxTrees.visitors.DeclarationVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class UnaryOperatorDeclaration extends Declaration {
public UnaryOperatorDeclaration(Operator oAST, TypeDenoter argAST, TypeDenoter resultAST, SourcePosition position) {
super(position);
O = oAST;
ARG = argAST;
RES = resultAST;
}
public <TArg, TResult> TResult visit(DeclarationVisitor<TArg, TResult> v, TArg arg) {
return v.visitUnaryOperatorDeclaration(this, arg);
}
public final Operator O;
public final TypeDenoter ARG, RES;
}
@@ -0,0 +1,36 @@
/*
* @(#)VarDeclaration.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.declarations;
import triangle.abstractSyntaxTrees.terminals.Identifier;
import triangle.abstractSyntaxTrees.types.TypeDenoter;
import triangle.abstractSyntaxTrees.visitors.DeclarationVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class VarDeclaration extends Declaration {
public VarDeclaration(Identifier iAST, TypeDenoter tAST, SourcePosition position) {
super(position);
I = iAST;
T = tAST;
}
public <TArg, TResult> TResult visit(DeclarationVisitor<TArg, TResult> v, TArg arg) {
return v.visitVarDeclaration(this, arg);
}
public final Identifier I;
public TypeDenoter T;
}
@@ -0,0 +1,33 @@
/*
* @(#)ArrayExpression.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.expressions;
import triangle.abstractSyntaxTrees.aggregates.ArrayAggregate;
import triangle.abstractSyntaxTrees.visitors.ExpressionVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class ArrayExpression extends Expression {
public ArrayExpression(ArrayAggregate aaAST, SourcePosition position) {
super(position);
AA = aaAST;
}
public <TArg, TResult> TResult visit(ExpressionVisitor<TArg, TResult> v, TArg arg) {
return v.visitArrayExpression(this, arg);
}
public final ArrayAggregate AA;
}
@@ -0,0 +1,36 @@
/*
* @(#)BinaryExpression.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.expressions;
import triangle.abstractSyntaxTrees.terminals.Operator;
import triangle.abstractSyntaxTrees.visitors.ExpressionVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class BinaryExpression extends Expression {
public BinaryExpression(Expression e1AST, Operator oAST, Expression e2AST, SourcePosition position) {
super(position);
O = oAST;
E1 = e1AST;
E2 = e2AST;
}
public <TArg, TResult> TResult visit(ExpressionVisitor<TArg, TResult> v, TArg arg) {
return v.visitBinaryExpression(this, arg);
}
public final Expression E1, E2;
public final Operator O;
}
@@ -0,0 +1,36 @@
/*
* @(#)CallExpression.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.expressions;
import triangle.abstractSyntaxTrees.actuals.ActualParameterSequence;
import triangle.abstractSyntaxTrees.terminals.Identifier;
import triangle.abstractSyntaxTrees.visitors.ExpressionVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class CallExpression extends Expression {
public CallExpression(Identifier iAST, ActualParameterSequence apsAST, SourcePosition position) {
super(position);
I = iAST;
APS = apsAST;
}
public <TArg, TResult> TResult visit(ExpressionVisitor<TArg, TResult> v, TArg arg) {
return v.visitCallExpression(this, arg);
}
public final Identifier I;
public final ActualParameterSequence APS;
}
@@ -0,0 +1,33 @@
/*
* @(#)CharacterExpression.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.expressions;
import triangle.abstractSyntaxTrees.terminals.CharacterLiteral;
import triangle.abstractSyntaxTrees.visitors.ExpressionVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class CharacterExpression extends Expression {
public CharacterExpression(CharacterLiteral clAST, SourcePosition position) {
super(position);
CL = clAST;
}
public <TArg, TResult> TResult visit(ExpressionVisitor<TArg, TResult> v, TArg arg) {
return v.visitCharacterExpression(this, arg);
}
public final CharacterLiteral CL;
}
@@ -0,0 +1,29 @@
/*
* @(#)EmptyExpression.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.expressions;
import triangle.abstractSyntaxTrees.visitors.ExpressionVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class EmptyExpression extends Expression {
public EmptyExpression(SourcePosition position) {
super(position);
}
public <TArg, TResult> TResult visit(ExpressionVisitor<TArg, TResult> v, TArg arg) {
return v.visitEmptyExpression(this, arg);
}
}
@@ -0,0 +1,36 @@
/*
* @(#)Expression.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.expressions;
import triangle.abstractSyntaxTrees.AbstractSyntaxTree;
import triangle.abstractSyntaxTrees.types.TypeDenoter;
import triangle.abstractSyntaxTrees.visitors.ExpressionVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public abstract class Expression extends AbstractSyntaxTree {
public Expression(SourcePosition position) {
super(position);
type = null;
}
public TypeDenoter type;
public abstract <TArg, TResult> TResult visit(ExpressionVisitor<TArg, TResult> visitor, TArg arg);
public <TArg, TResult> TResult visit(ExpressionVisitor<TArg, TResult> visitor) {
return visit(visitor, null);
}
}
@@ -0,0 +1,34 @@
/*
* @(#)IfExpression.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.expressions;
import triangle.abstractSyntaxTrees.visitors.ExpressionVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class IfExpression extends Expression {
public IfExpression(Expression e1AST, Expression e2AST, Expression e3AST, SourcePosition position) {
super(position);
E1 = e1AST;
E2 = e2AST;
E3 = e3AST;
}
public <TArg, TResult> TResult visit(ExpressionVisitor<TArg, TResult> v, TArg arg) {
return v.visitIfExpression(this, arg);
}
public final Expression E1, E2, E3;
}
@@ -0,0 +1,33 @@
/*
* @(#)IntegerExpression.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.expressions;
import triangle.abstractSyntaxTrees.terminals.IntegerLiteral;
import triangle.abstractSyntaxTrees.visitors.ExpressionVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class IntegerExpression extends Expression {
public IntegerExpression(IntegerLiteral ilAST, SourcePosition position) {
super(position);
IL = ilAST;
}
public <TArg, TResult> TResult visit(ExpressionVisitor<TArg, TResult> v, TArg arg) {
return v.visitIntegerExpression(this, arg);
}
public final IntegerLiteral IL;
}
@@ -0,0 +1,35 @@
/*
* @(#)LetExpression.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.expressions;
import triangle.abstractSyntaxTrees.declarations.Declaration;
import triangle.abstractSyntaxTrees.visitors.ExpressionVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class LetExpression extends Expression {
public LetExpression(Declaration dAST, Expression eAST, SourcePosition position) {
super(position);
D = dAST;
E = eAST;
}
public <TArg, TResult> TResult visit(ExpressionVisitor<TArg, TResult> v, TArg arg) {
return v.visitLetExpression(this, arg);
}
public final Declaration D;
public final Expression E;
}
@@ -0,0 +1,33 @@
/*
* @(#)RecordExpression.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.expressions;
import triangle.abstractSyntaxTrees.aggregates.RecordAggregate;
import triangle.abstractSyntaxTrees.visitors.ExpressionVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class RecordExpression extends Expression {
public RecordExpression(RecordAggregate raAST, SourcePosition position) {
super(position);
RA = raAST;
}
public <TArg, TResult> TResult visit(ExpressionVisitor<TArg, TResult> v, TArg arg) {
return v.visitRecordExpression(this, arg);
}
public final RecordAggregate RA;
}
@@ -0,0 +1,35 @@
/*
* @(#)UnaryExpression.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.expressions;
import triangle.abstractSyntaxTrees.terminals.Operator;
import triangle.abstractSyntaxTrees.visitors.ExpressionVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class UnaryExpression extends Expression {
public UnaryExpression(Operator oAST, Expression eAST, SourcePosition position) {
super(position);
O = oAST;
E = eAST;
}
public <TArg, TResult> TResult visit(ExpressionVisitor<TArg, TResult> v, TArg arg) {
return v.visitUnaryExpression(this, arg);
}
public final Expression E;
public final Operator O;
}
@@ -0,0 +1,33 @@
/*
* @(#)VnameExpression.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.expressions;
import triangle.abstractSyntaxTrees.visitors.ExpressionVisitor;
import triangle.abstractSyntaxTrees.vnames.Vname;
import triangle.syntacticAnalyzer.SourcePosition;
public class VnameExpression extends Expression {
public VnameExpression(Vname vAST, SourcePosition position) {
super(position);
V = vAST;
}
public <TArg, TResult> TResult visit(ExpressionVisitor<TArg, TResult> v, TArg arg) {
return v.visitVnameExpression(this, arg);
}
public final Vname V;
}
@@ -0,0 +1,46 @@
/*
* @(#)ConstFormalParameter.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.formals;
import triangle.abstractSyntaxTrees.terminals.Identifier;
import triangle.abstractSyntaxTrees.types.TypeDenoter;
import triangle.abstractSyntaxTrees.visitors.DeclarationVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class ConstFormalParameter extends FormalParameter {
public ConstFormalParameter(Identifier iAST, TypeDenoter tAST, SourcePosition position) {
super(position);
I = iAST;
T = tAST;
}
public <TArg, TResult> TResult visit(DeclarationVisitor<TArg, TResult> v, TArg arg) {
return v.visitConstFormalParameter(this, arg);
}
@Override
public boolean equals(Object fpAST) {
if (fpAST instanceof ConstFormalParameter) {
var cfpAST = (ConstFormalParameter) fpAST;
return T.equals(cfpAST.T);
} else {
return false;
}
}
public final Identifier I;
public TypeDenoter T;
}
@@ -0,0 +1,34 @@
/*
* @(#)EmptyFormalParameterSequence.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.formals;
import triangle.abstractSyntaxTrees.visitors.FormalParameterSequenceVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class EmptyFormalParameterSequence extends FormalParameterSequence {
public EmptyFormalParameterSequence(SourcePosition position) {
super(position);
}
public <TArg, TResult> TResult visit(FormalParameterSequenceVisitor<TArg, TResult> v, TArg arg) {
return v.visitEmptyFormalParameterSequence(this, arg);
}
@Override
public boolean equals(Object fpsAST) {
return (fpsAST instanceof EmptyFormalParameterSequence);
}
}
@@ -0,0 +1,35 @@
/*
* @(#)FormalParameter.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.formals;
import triangle.abstractSyntaxTrees.declarations.Declaration;
import triangle.abstractSyntaxTrees.visitors.DeclarationVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public abstract class FormalParameter extends Declaration {
public FormalParameter(SourcePosition position) {
super(position);
}
@Override
public abstract boolean equals(Object fpAST);
public abstract <TArg, TResult> TResult visit(DeclarationVisitor<TArg, TResult> visitor, TArg arg);
public <TArg, TResult> TResult visit(DeclarationVisitor<TArg, TResult> visitor) {
return visit(visitor, null);
}
}
@@ -0,0 +1,35 @@
/*
* @(#)FormalParameterSequence.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.formals;
import triangle.abstractSyntaxTrees.AbstractSyntaxTree;
import triangle.abstractSyntaxTrees.visitors.FormalParameterSequenceVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public abstract class FormalParameterSequence extends AbstractSyntaxTree {
public FormalParameterSequence(SourcePosition position) {
super(position);
}
@Override
public abstract boolean equals(Object fpsAST);
public abstract <TArg, TResult> TResult visit(FormalParameterSequenceVisitor<TArg, TResult> visitor, TArg arg);
public <TArg, TResult> TResult visit(FormalParameterSequenceVisitor<TArg, TResult> visitor) {
return visit(visitor, null);
}
}
@@ -0,0 +1,48 @@
/*
* @(#)FuncFormalParameter.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.formals;
import triangle.abstractSyntaxTrees.terminals.Identifier;
import triangle.abstractSyntaxTrees.types.TypeDenoter;
import triangle.abstractSyntaxTrees.visitors.DeclarationVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class FuncFormalParameter extends FormalParameter {
public FuncFormalParameter(Identifier iAST, FormalParameterSequence fpsAST, TypeDenoter tAST,
SourcePosition position) {
super(position);
I = iAST;
FPS = fpsAST;
T = tAST;
}
public <TArg, TResult> TResult visit(DeclarationVisitor<TArg, TResult> v, TArg arg) {
return v.visitFuncFormalParameter(this, arg);
}
@Override
public boolean equals(Object fpAST) {
if (fpAST instanceof FuncFormalParameter) {
FuncFormalParameter ffpAST = (FuncFormalParameter) fpAST;
return FPS.equals(ffpAST.FPS) && T.equals(ffpAST.T);
} else
return false;
}
public final Identifier I;
public final FormalParameterSequence FPS;
public TypeDenoter T;
}
@@ -0,0 +1,45 @@
/*
* @(#)MultipleFormalParameterSequence.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.formals;
import triangle.abstractSyntaxTrees.visitors.FormalParameterSequenceVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class MultipleFormalParameterSequence extends FormalParameterSequence {
public MultipleFormalParameterSequence(FormalParameter fpAST, FormalParameterSequence fpsAST,
SourcePosition position) {
super(position);
FP = fpAST;
FPS = fpsAST;
}
public <TArg, TResult> TResult visit(FormalParameterSequenceVisitor<TArg, TResult> v, TArg arg) {
return v.visitMultipleFormalParameterSequence(this, arg);
}
@Override
public boolean equals(Object fpsAST) {
if (fpsAST instanceof MultipleFormalParameterSequence) {
MultipleFormalParameterSequence mfpsAST = (MultipleFormalParameterSequence) fpsAST;
return FP.equals(mfpsAST.FP) && FPS.equals(mfpsAST.FPS);
} else {
return false;
}
}
public final FormalParameter FP;
public final FormalParameterSequence FPS;
}
@@ -0,0 +1,45 @@
/*
* @(#)ProcFormalParameter.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.formals;
import triangle.abstractSyntaxTrees.terminals.Identifier;
import triangle.abstractSyntaxTrees.visitors.DeclarationVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class ProcFormalParameter extends FormalParameter {
public ProcFormalParameter(Identifier iAST, FormalParameterSequence fpsAST, SourcePosition position) {
super(position);
I = iAST;
FPS = fpsAST;
}
public <TArg, TResult> TResult visit(DeclarationVisitor<TArg, TResult> v, TArg arg) {
return v.visitProcFormalParameter(this, arg);
}
@Override
public boolean equals(Object fpAST) {
if (fpAST instanceof ProcFormalParameter) {
ProcFormalParameter pfpAST = (ProcFormalParameter) fpAST;
return FPS.equals(pfpAST.FPS);
} else {
return false;
}
}
public final Identifier I;
public final FormalParameterSequence FPS;
}
@@ -0,0 +1,42 @@
/*
* @(#)SingleFormalParameterSequence.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.formals;
import triangle.abstractSyntaxTrees.visitors.FormalParameterSequenceVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class SingleFormalParameterSequence extends FormalParameterSequence {
public SingleFormalParameterSequence(FormalParameter fpAST, SourcePosition position) {
super(position);
FP = fpAST;
}
public <TArg, TResult> TResult visit(FormalParameterSequenceVisitor<TArg, TResult> v, TArg arg) {
return v.visitSingleFormalParameterSequence(this, arg);
}
@Override
public boolean equals(Object fpsAST) {
if (fpsAST instanceof SingleFormalParameterSequence) {
SingleFormalParameterSequence sfpsAST = (SingleFormalParameterSequence) fpsAST;
return FP.equals(sfpsAST.FP);
} else {
return false;
}
}
public final FormalParameter FP;
}
@@ -0,0 +1,46 @@
/*
* @(#)ValFormalParameter.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.formals;
import triangle.abstractSyntaxTrees.terminals.Identifier;
import triangle.abstractSyntaxTrees.types.TypeDenoter;
import triangle.abstractSyntaxTrees.visitors.DeclarationVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class VarFormalParameter extends FormalParameter {
public VarFormalParameter(Identifier iAST, TypeDenoter tAST, SourcePosition position) {
super(position);
I = iAST;
T = tAST;
}
public <TArg, TResult> TResult visit(DeclarationVisitor<TArg, TResult> v, TArg arg) {
return v.visitVarFormalParameter(this, arg);
}
@Override
public boolean equals(Object fpAST) {
if (fpAST instanceof VarFormalParameter) {
VarFormalParameter vfpAST = (VarFormalParameter) fpAST;
return T.equals(vfpAST.T);
} else {
return false;
}
}
public final Identifier I;
public TypeDenoter T;
}
@@ -0,0 +1,37 @@
/*
* @(#)CharacterLiteral.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.terminals;
import triangle.abstractSyntaxTrees.visitors.LiteralVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class CharacterLiteral extends Terminal {
public CharacterLiteral(String spelling, SourcePosition position) {
super(spelling, position);
}
public <TArg, TResult> TResult visit(LiteralVisitor<TArg, TResult> v, TArg arg) {
return v.visitCharacterLiteral(this, arg);
}
public <TArg, TResult> TResult visit(LiteralVisitor<TArg, TResult> visitor) {
return visit(visitor, null);
}
public int getValue() {
return spelling.charAt(1);
}
}
@@ -0,0 +1,40 @@
/*
* @(#)Identifier.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.terminals;
import triangle.abstractSyntaxTrees.AbstractSyntaxTree;
import triangle.abstractSyntaxTrees.types.TypeDenoter;
import triangle.abstractSyntaxTrees.visitors.IdentifierVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class Identifier extends Terminal {
public Identifier(String spelling, SourcePosition position) {
super(spelling, position);
type = null;
decl = null;
}
public TypeDenoter type;
public AbstractSyntaxTree decl; // Either a Declaration or a FieldTypeDenoter
public <TArg, TResult> TResult visit(IdentifierVisitor<TArg, TResult> visitor, TArg arg) {
return visitor.visitIdentifier(this, arg);
}
public <TArg, TResult> TResult visit(IdentifierVisitor<TArg, TResult> visitor) {
return visit(visitor, null);
}
}
@@ -0,0 +1,37 @@
/*
* @(#)IntegerLiteral.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.terminals;
import triangle.abstractSyntaxTrees.visitors.LiteralVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class IntegerLiteral extends Terminal {
public IntegerLiteral(String spelling, SourcePosition position) {
super(spelling, position);
}
public <TArg, TResult> TResult visit(LiteralVisitor<TArg, TResult> v, TArg arg) {
return v.visitIntegerLiteral(this, arg);
}
public <TArg, TResult> TResult visit(LiteralVisitor<TArg, TResult> visitor) {
return visit(visitor, null);
}
public int getValue() {
return Integer.parseInt(spelling);
}
}
@@ -0,0 +1,37 @@
/*
* @(#)Operator.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.terminals;
import triangle.abstractSyntaxTrees.declarations.Declaration;
import triangle.abstractSyntaxTrees.visitors.OperatorVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class Operator extends Terminal {
public Operator(String spelling, SourcePosition position) {
super(spelling, position);
decl = null;
}
public Declaration decl;
public <TArg, TResult> TResult visit(OperatorVisitor<TArg, TResult> v, TArg arg) {
return v.visitOperator(this, arg);
}
public <TArg, TResult> TResult visit(OperatorVisitor<TArg, TResult> visitor) {
return visit(visitor, null);
}
}
@@ -0,0 +1,28 @@
/*
* @(#)Terminal.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.terminals;
import triangle.abstractSyntaxTrees.AbstractSyntaxTree;
import triangle.syntacticAnalyzer.SourcePosition;
public abstract class Terminal extends AbstractSyntaxTree {
public Terminal(String spelling, SourcePosition position) {
super(position);
this.spelling = spelling;
}
public final String spelling;
}
@@ -0,0 +1,34 @@
/*
* @(#)AnyTypeDenoter.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.types;
import triangle.abstractSyntaxTrees.visitors.TypeDenoterVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class AnyTypeDenoter extends TypeDenoter {
public AnyTypeDenoter(SourcePosition position) {
super(position);
}
public <TArg, TResult> TResult visit(TypeDenoterVisitor<TArg, TResult> v, TArg arg) {
return v.visitAnyTypeDenoter(this, arg);
}
@Override
public boolean equals(Object obj) {
return false;
}
}
@@ -0,0 +1,47 @@
/*
* @(#)ArrayTypeDenoter.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.types;
import triangle.abstractSyntaxTrees.terminals.IntegerLiteral;
import triangle.abstractSyntaxTrees.visitors.TypeDenoterVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class ArrayTypeDenoter extends TypeDenoter {
public ArrayTypeDenoter(IntegerLiteral ilAST, TypeDenoter tAST, SourcePosition position) {
super(position);
IL = ilAST;
T = tAST;
}
public <TArg, TResult> TResult visit(TypeDenoterVisitor<TArg, TResult> v, TArg arg) {
return v.visitArrayTypeDenoter(this, arg);
}
@Override
public boolean equals(Object obj) {
if (obj != null && obj instanceof ErrorTypeDenoter) {
return true;
} else if (obj != null && obj instanceof ArrayTypeDenoter) {
return this.IL.spelling.compareTo(((ArrayTypeDenoter) obj).IL.spelling) == 0
&& this.T.equals(((ArrayTypeDenoter) obj).T);
} else {
return false;
}
}
public final IntegerLiteral IL;
public TypeDenoter T;
}
@@ -0,0 +1,38 @@
/*
* @(#)BoolTypeDenoter.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.types;
import triangle.abstractSyntaxTrees.visitors.TypeDenoterVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class BoolTypeDenoter extends TypeDenoter {
public BoolTypeDenoter(SourcePosition position) {
super(position);
}
public <TArg, TResult> TResult visit(TypeDenoterVisitor<TArg, TResult> v, TArg arg) {
return v.visitBoolTypeDenoter(this, arg);
}
@Override
public boolean equals(Object obj) {
if ((obj != null) && (obj instanceof ErrorTypeDenoter)) {
return true;
} else {
return ((obj != null) && (obj instanceof BoolTypeDenoter));
}
}
}
@@ -0,0 +1,38 @@
/*
* @(#)CharTypeDenoter.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.types;
import triangle.abstractSyntaxTrees.visitors.TypeDenoterVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class CharTypeDenoter extends TypeDenoter {
public CharTypeDenoter(SourcePosition position) {
super(position);
}
public <TArg, TResult> TResult visit(TypeDenoterVisitor<TArg, TResult> v, TArg arg) {
return v.visitCharTypeDenoter(this, arg);
}
@Override
public boolean equals(Object obj) {
if (obj != null && obj instanceof ErrorTypeDenoter) {
return true;
} else {
return (obj != null && obj instanceof CharTypeDenoter);
}
}
}
@@ -0,0 +1,34 @@
/*
* @(#)ErrorTypeDenoter.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.types;
import triangle.abstractSyntaxTrees.visitors.TypeDenoterVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class ErrorTypeDenoter extends TypeDenoter {
public ErrorTypeDenoter(SourcePosition position) {
super(position);
}
public <TArg, TResult> TResult visit(TypeDenoterVisitor<TArg, TResult> v, TArg arg) {
return v.visitErrorTypeDenoter(this, arg);
}
@Override
public boolean equals(Object obj) {
return true;
}
}
@@ -0,0 +1,24 @@
/*
* @(#)FieldTypeDenoter.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.types;
import triangle.syntacticAnalyzer.SourcePosition;
public abstract class FieldTypeDenoter extends TypeDenoter {
public FieldTypeDenoter(SourcePosition position) {
super(position);
}
}
@@ -0,0 +1,38 @@
/*
* @(#)IntTypeDenoter.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.types;
import triangle.abstractSyntaxTrees.visitors.TypeDenoterVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class IntTypeDenoter extends TypeDenoter {
public IntTypeDenoter(SourcePosition position) {
super(position);
}
public <TArg, TResult> TResult visit(TypeDenoterVisitor<TArg, TResult> v, TArg arg) {
return v.visitIntTypeDenoter(this, arg);
}
@Override
public boolean equals(Object obj) {
if (obj != null && obj instanceof ErrorTypeDenoter) {
return true;
} else {
return (obj != null && obj instanceof IntTypeDenoter);
}
}
}
@@ -0,0 +1,48 @@
/*
* @(#)MultipleFieldTypeDenoter.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.types;
import triangle.abstractSyntaxTrees.terminals.Identifier;
import triangle.abstractSyntaxTrees.visitors.TypeDenoterVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class MultipleFieldTypeDenoter extends FieldTypeDenoter {
public MultipleFieldTypeDenoter(Identifier iAST, TypeDenoter tAST, FieldTypeDenoter ftAST,
SourcePosition position) {
super(position);
I = iAST;
T = tAST;
FT = ftAST;
}
public <TArg, TResult> TResult visit(TypeDenoterVisitor<TArg, TResult> v, TArg arg) {
return v.visitMultipleFieldTypeDenoter(this, arg);
}
@Override
public boolean equals(Object obj) {
if (obj != null && obj instanceof MultipleFieldTypeDenoter) {
MultipleFieldTypeDenoter ft = (MultipleFieldTypeDenoter) obj;
return (this.I.spelling.compareTo(ft.I.spelling) == 0) && this.T.equals(ft.T) && this.FT.equals(ft.FT);
} else {
return false;
}
}
public final Identifier I;
public TypeDenoter T;
public FieldTypeDenoter FT;
}
@@ -0,0 +1,43 @@
/*
* @(#)RecordTypeDenoter.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.types;
import triangle.abstractSyntaxTrees.visitors.TypeDenoterVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class RecordTypeDenoter extends TypeDenoter {
public RecordTypeDenoter(FieldTypeDenoter ftAST, SourcePosition position) {
super(position);
FT = ftAST;
}
public <TArg, TResult> TResult visit(TypeDenoterVisitor<TArg, TResult> v, TArg arg) {
return v.visitRecordTypeDenoter(this, arg);
}
@Override
public boolean equals(Object obj) {
if (obj != null && obj instanceof ErrorTypeDenoter) {
return true;
} else if (obj != null && obj instanceof RecordTypeDenoter) {
return this.FT.equals(((RecordTypeDenoter) obj).FT);
} else {
return false;
}
}
public FieldTypeDenoter FT;
}
@@ -0,0 +1,38 @@
/*
* @(#)SimpleTypeDenoter.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.types;
import triangle.abstractSyntaxTrees.terminals.Identifier;
import triangle.abstractSyntaxTrees.visitors.TypeDenoterVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class SimpleTypeDenoter extends TypeDenoter {
public SimpleTypeDenoter(Identifier iAST, SourcePosition position) {
super(position);
I = iAST;
}
public <TArg, TResult> TResult visit(TypeDenoterVisitor<TArg, TResult> v, TArg arg) {
return v.visitSimpleTypeDenoter(this, arg);
}
@Override
public boolean equals(Object obj) {
return false; // should not happen
}
public final Identifier I;
}
@@ -0,0 +1,45 @@
/*
* @(#)SingleFieldTypeDenoter.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.types;
import triangle.abstractSyntaxTrees.terminals.Identifier;
import triangle.abstractSyntaxTrees.visitors.TypeDenoterVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class SingleFieldTypeDenoter extends FieldTypeDenoter {
public SingleFieldTypeDenoter(Identifier iAST, TypeDenoter tAST, SourcePosition position) {
super(position);
I = iAST;
T = tAST;
}
public <TArg, TResult> TResult visit(TypeDenoterVisitor<TArg, TResult> v, TArg arg) {
return v.visitSingleFieldTypeDenoter(this, arg);
}
@Override
public boolean equals(Object obj) {
if (obj != null && obj instanceof SingleFieldTypeDenoter) {
SingleFieldTypeDenoter ft = (SingleFieldTypeDenoter) obj;
return (this.I.spelling.compareTo(ft.I.spelling) == 0) && this.T.equals(ft.T);
} else {
return false;
}
}
public final Identifier I;
public TypeDenoter T;
}
@@ -0,0 +1,36 @@
/*
* @(#)TypeDeclaration.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.types;
import triangle.abstractSyntaxTrees.declarations.Declaration;
import triangle.abstractSyntaxTrees.terminals.Identifier;
import triangle.abstractSyntaxTrees.visitors.DeclarationVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class TypeDeclaration extends Declaration {
public TypeDeclaration(Identifier iAST, TypeDenoter tAST, SourcePosition position) {
super(position);
I = iAST;
T = tAST;
}
public <TArg, TResult> TResult visit(DeclarationVisitor<TArg, TResult> v, TArg arg) {
return v.visitTypeDeclaration(this, arg);
}
public final Identifier I;
public TypeDenoter T;
}
@@ -0,0 +1,35 @@
/*
* @(#)TypeDenoter.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.types;
import triangle.abstractSyntaxTrees.AbstractSyntaxTree;
import triangle.abstractSyntaxTrees.visitors.TypeDenoterVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public abstract class TypeDenoter extends AbstractSyntaxTree {
public TypeDenoter(SourcePosition position) {
super(position);
}
@Override
public abstract boolean equals(Object obj);
public abstract <TArg, TResult> TResult visit(TypeDenoterVisitor<TArg, TResult> visitor, TArg arg);
public <TArg, TResult> TResult visit(TypeDenoterVisitor<TArg, TResult> visitor) {
return visit(visitor, null);
}
}
@@ -0,0 +1,15 @@
package triangle.abstractSyntaxTrees.visitors;
import triangle.abstractSyntaxTrees.actuals.EmptyActualParameterSequence;
import triangle.abstractSyntaxTrees.actuals.MultipleActualParameterSequence;
import triangle.abstractSyntaxTrees.actuals.SingleActualParameterSequence;
public interface ActualParameterSequenceVisitor<TArg, TResult> {
TResult visitEmptyActualParameterSequence(EmptyActualParameterSequence ast, TArg arg);
TResult visitMultipleActualParameterSequence(MultipleActualParameterSequence ast, TArg arg);
TResult visitSingleActualParameterSequence(SingleActualParameterSequence ast, TArg arg);
}
@@ -0,0 +1,18 @@
package triangle.abstractSyntaxTrees.visitors;
import triangle.abstractSyntaxTrees.actuals.ConstActualParameter;
import triangle.abstractSyntaxTrees.actuals.FuncActualParameter;
import triangle.abstractSyntaxTrees.actuals.ProcActualParameter;
import triangle.abstractSyntaxTrees.actuals.VarActualParameter;
public interface ActualParameterVisitor<TArg, TResult> {
TResult visitConstActualParameter(ConstActualParameter ast, TArg arg);
TResult visitFuncActualParameter(FuncActualParameter ast, TArg arg);
TResult visitProcActualParameter(ProcActualParameter ast, TArg arg);
TResult visitVarActualParameter(VarActualParameter ast, TArg arg);
}
@@ -0,0 +1,12 @@
package triangle.abstractSyntaxTrees.visitors;
import triangle.abstractSyntaxTrees.aggregates.MultipleArrayAggregate;
import triangle.abstractSyntaxTrees.aggregates.SingleArrayAggregate;
public interface ArrayAggregateVisitor<TArg, TResult> {
TResult visitMultipleArrayAggregate(MultipleArrayAggregate ast, TArg arg);
TResult visitSingleArrayAggregate(SingleArrayAggregate ast, TArg arg);
}
@@ -0,0 +1,27 @@
package triangle.abstractSyntaxTrees.visitors;
import triangle.abstractSyntaxTrees.commands.AssignCommand;
import triangle.abstractSyntaxTrees.commands.CallCommand;
import triangle.abstractSyntaxTrees.commands.EmptyCommand;
import triangle.abstractSyntaxTrees.commands.IfCommand;
import triangle.abstractSyntaxTrees.commands.LetCommand;
import triangle.abstractSyntaxTrees.commands.SequentialCommand;
import triangle.abstractSyntaxTrees.commands.WhileCommand;
public interface CommandVisitor<TArg, TResult> {
TResult visitAssignCommand(AssignCommand ast, TArg arg);
TResult visitCallCommand(CallCommand ast, TArg arg);
TResult visitEmptyCommand(EmptyCommand ast, TArg arg);
TResult visitIfCommand(IfCommand ast, TArg arg);
TResult visitLetCommand(LetCommand ast, TArg arg);
TResult visitSequentialCommand(SequentialCommand ast, TArg arg);
TResult visitWhileCommand(WhileCommand ast, TArg arg);
}
@@ -0,0 +1,30 @@
package triangle.abstractSyntaxTrees.visitors;
import triangle.abstractSyntaxTrees.declarations.BinaryOperatorDeclaration;
import triangle.abstractSyntaxTrees.declarations.ConstDeclaration;
import triangle.abstractSyntaxTrees.declarations.FuncDeclaration;
import triangle.abstractSyntaxTrees.declarations.ProcDeclaration;
import triangle.abstractSyntaxTrees.declarations.SequentialDeclaration;
import triangle.abstractSyntaxTrees.declarations.UnaryOperatorDeclaration;
import triangle.abstractSyntaxTrees.declarations.VarDeclaration;
import triangle.abstractSyntaxTrees.types.TypeDeclaration;
public interface DeclarationVisitor<TArg, TResult> extends FormalParameterVisitor<TArg, TResult> {
TResult visitBinaryOperatorDeclaration(BinaryOperatorDeclaration ast, TArg arg);
TResult visitConstDeclaration(ConstDeclaration ast, TArg arg);
TResult visitFuncDeclaration(FuncDeclaration ast, TArg arg);
TResult visitProcDeclaration(ProcDeclaration ast, TArg arg);
TResult visitSequentialDeclaration(SequentialDeclaration ast, TArg arg);
TResult visitTypeDeclaration(TypeDeclaration ast, TArg arg);
TResult visitUnaryOperatorDeclaration(UnaryOperatorDeclaration ast, TArg arg);
TResult visitVarDeclaration(VarDeclaration ast, TArg arg);
}
@@ -0,0 +1,39 @@
package triangle.abstractSyntaxTrees.visitors;
import triangle.abstractSyntaxTrees.expressions.ArrayExpression;
import triangle.abstractSyntaxTrees.expressions.BinaryExpression;
import triangle.abstractSyntaxTrees.expressions.CallExpression;
import triangle.abstractSyntaxTrees.expressions.CharacterExpression;
import triangle.abstractSyntaxTrees.expressions.EmptyExpression;
import triangle.abstractSyntaxTrees.expressions.IfExpression;
import triangle.abstractSyntaxTrees.expressions.IntegerExpression;
import triangle.abstractSyntaxTrees.expressions.LetExpression;
import triangle.abstractSyntaxTrees.expressions.RecordExpression;
import triangle.abstractSyntaxTrees.expressions.UnaryExpression;
import triangle.abstractSyntaxTrees.expressions.VnameExpression;
public interface ExpressionVisitor<TArg, TResult> {
TResult visitArrayExpression(ArrayExpression ast, TArg arg);
TResult visitBinaryExpression(BinaryExpression ast, TArg arg);
TResult visitCallExpression(CallExpression ast, TArg arg);
TResult visitCharacterExpression(CharacterExpression ast, TArg arg);
TResult visitEmptyExpression(EmptyExpression ast, TArg arg);
TResult visitIfExpression(IfExpression ast, TArg arg);
TResult visitIntegerExpression(IntegerExpression ast, TArg arg);
TResult visitLetExpression(LetExpression ast, TArg arg);
TResult visitRecordExpression(RecordExpression ast, TArg arg);
TResult visitUnaryExpression(UnaryExpression ast, TArg arg);
TResult visitVnameExpression(VnameExpression ast, TArg arg);
}
@@ -0,0 +1,12 @@
package triangle.abstractSyntaxTrees.visitors;
import triangle.abstractSyntaxTrees.types.MultipleFieldTypeDenoter;
import triangle.abstractSyntaxTrees.types.SingleFieldTypeDenoter;
public interface FieldTypeDenoterVisitor<TArg, TResult> {
TResult visitMultipleFieldTypeDenoter(MultipleFieldTypeDenoter ast, TArg arg);
TResult visitSingleFieldTypeDenoter(SingleFieldTypeDenoter ast, TArg arg);
}
@@ -0,0 +1,15 @@
package triangle.abstractSyntaxTrees.visitors;
import triangle.abstractSyntaxTrees.formals.EmptyFormalParameterSequence;
import triangle.abstractSyntaxTrees.formals.MultipleFormalParameterSequence;
import triangle.abstractSyntaxTrees.formals.SingleFormalParameterSequence;
public interface FormalParameterSequenceVisitor<TArg, TResult> {
TResult visitEmptyFormalParameterSequence(EmptyFormalParameterSequence ast, TArg arg);
TResult visitMultipleFormalParameterSequence(MultipleFormalParameterSequence ast, TArg arg);
TResult visitSingleFormalParameterSequence(SingleFormalParameterSequence ast, TArg arg);
}
@@ -0,0 +1,18 @@
package triangle.abstractSyntaxTrees.visitors;
import triangle.abstractSyntaxTrees.formals.ConstFormalParameter;
import triangle.abstractSyntaxTrees.formals.FuncFormalParameter;
import triangle.abstractSyntaxTrees.formals.ProcFormalParameter;
import triangle.abstractSyntaxTrees.formals.VarFormalParameter;
public interface FormalParameterVisitor<TArg, TResult> {
TResult visitConstFormalParameter(ConstFormalParameter ast, TArg arg);
TResult visitFuncFormalParameter(FuncFormalParameter ast, TArg arg);
TResult visitProcFormalParameter(ProcFormalParameter ast, TArg arg);
TResult visitVarFormalParameter(VarFormalParameter ast, TArg arg);
}
@@ -0,0 +1,9 @@
package triangle.abstractSyntaxTrees.visitors;
import triangle.abstractSyntaxTrees.terminals.Identifier;
public interface IdentifierVisitor<TArg, TResult> {
TResult visitIdentifier(Identifier ast, TArg arg);
}
@@ -0,0 +1,12 @@
package triangle.abstractSyntaxTrees.visitors;
import triangle.abstractSyntaxTrees.terminals.CharacterLiteral;
import triangle.abstractSyntaxTrees.terminals.IntegerLiteral;
public interface LiteralVisitor<TArg, TResult> {
TResult visitCharacterLiteral(CharacterLiteral ast, TArg arg);
TResult visitIntegerLiteral(IntegerLiteral ast, TArg arg);
}
@@ -0,0 +1,9 @@
package triangle.abstractSyntaxTrees.visitors;
import triangle.abstractSyntaxTrees.terminals.Operator;
public interface OperatorVisitor<TArg, TResult> {
TResult visitOperator(Operator ast, TArg arg);
}
@@ -0,0 +1,9 @@
package triangle.abstractSyntaxTrees.visitors;
import triangle.abstractSyntaxTrees.Program;
public interface ProgramVisitor<TArg, TResult> {
TResult visitProgram(Program ast, TArg arg);
}
@@ -0,0 +1,12 @@
package triangle.abstractSyntaxTrees.visitors;
import triangle.abstractSyntaxTrees.aggregates.MultipleRecordAggregate;
import triangle.abstractSyntaxTrees.aggregates.SingleRecordAggregate;
public interface RecordAggregateVisitor<TArg, TResult> {
TResult visitMultipleRecordAggregate(MultipleRecordAggregate ast, TArg arg);
TResult visitSingleRecordAggregate(SingleRecordAggregate ast, TArg arg);
}
@@ -0,0 +1,30 @@
package triangle.abstractSyntaxTrees.visitors;
import triangle.abstractSyntaxTrees.types.AnyTypeDenoter;
import triangle.abstractSyntaxTrees.types.ArrayTypeDenoter;
import triangle.abstractSyntaxTrees.types.BoolTypeDenoter;
import triangle.abstractSyntaxTrees.types.CharTypeDenoter;
import triangle.abstractSyntaxTrees.types.ErrorTypeDenoter;
import triangle.abstractSyntaxTrees.types.IntTypeDenoter;
import triangle.abstractSyntaxTrees.types.RecordTypeDenoter;
import triangle.abstractSyntaxTrees.types.SimpleTypeDenoter;
public interface TypeDenoterVisitor<TArg, TResult> extends FieldTypeDenoterVisitor<TArg, TResult> {
TResult visitAnyTypeDenoter(AnyTypeDenoter ast, TArg arg);
TResult visitArrayTypeDenoter(ArrayTypeDenoter ast, TArg arg);
TResult visitBoolTypeDenoter(BoolTypeDenoter ast, TArg arg);
TResult visitCharTypeDenoter(CharTypeDenoter ast, TArg arg);
TResult visitErrorTypeDenoter(ErrorTypeDenoter ast, TArg arg);
TResult visitSimpleTypeDenoter(SimpleTypeDenoter ast, TArg arg);
TResult visitIntTypeDenoter(IntTypeDenoter ast, TArg arg);
TResult visitRecordTypeDenoter(RecordTypeDenoter ast, TArg arg);
}
@@ -0,0 +1,15 @@
package triangle.abstractSyntaxTrees.visitors;
import triangle.abstractSyntaxTrees.vnames.DotVname;
import triangle.abstractSyntaxTrees.vnames.SimpleVname;
import triangle.abstractSyntaxTrees.vnames.SubscriptVname;
public interface VnameVisitor<TArg, TResult> {
TResult visitDotVname(DotVname ast, TArg arg);
TResult visitSimpleVname(SimpleVname ast, TArg arg);
TResult visitSubscriptVname(SubscriptVname ast, TArg arg);
}
@@ -0,0 +1,35 @@
/*
* @(#)DotVname.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.vnames;
import triangle.abstractSyntaxTrees.terminals.Identifier;
import triangle.abstractSyntaxTrees.visitors.VnameVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class DotVname extends Vname {
public DotVname(Vname vAST, Identifier iAST, SourcePosition position) {
super(position);
V = vAST;
I = iAST;
}
public <TArg, TResult> TResult visit(VnameVisitor<TArg, TResult> v, TArg arg) {
return v.visitDotVname(this, arg);
}
public final Identifier I;
public final Vname V;
}
@@ -0,0 +1,33 @@
/*
* @(#)SimpleVname.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.vnames;
import triangle.abstractSyntaxTrees.terminals.Identifier;
import triangle.abstractSyntaxTrees.visitors.VnameVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class SimpleVname extends Vname {
public SimpleVname(Identifier iAST, SourcePosition position) {
super(position);
I = iAST;
}
public <TArg, TResult> TResult visit(VnameVisitor<TArg, TResult> v, TArg arg) {
return v.visitSimpleVname(this, arg);
}
public final Identifier I;
}
@@ -0,0 +1,35 @@
/*
* @(#)SubscriptVname.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.vnames;
import triangle.abstractSyntaxTrees.expressions.Expression;
import triangle.abstractSyntaxTrees.visitors.VnameVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public class SubscriptVname extends Vname {
public SubscriptVname(Vname vAST, Expression eAST, SourcePosition position) {
super(position);
V = vAST;
E = eAST;
}
public <TArg, TResult> TResult visit(VnameVisitor<TArg, TResult> v, TArg arg) {
return v.visitSubscriptVname(this, arg);
}
public final Expression E;
public final Vname V;
}
@@ -0,0 +1,39 @@
/*
* @(#)Vname.java 2.1 2003/10/07
*
* Copyright (C) 1999, 2003 D.A. Watt and D.F. Brown
* Dept. of Computing Science, University of Glasgow, Glasgow G12 8QQ Scotland
* and School of Computer and Math Sciences, The Robert Gordon University,
* St. Andrew Street, Aberdeen AB25 1HG, Scotland.
* All rights reserved.
*
* This software is provided free for educational use only. It may
* not be used for commercial purposes without the prior written permission
* of the authors.
*/
package triangle.abstractSyntaxTrees.vnames;
import triangle.abstractSyntaxTrees.AbstractSyntaxTree;
import triangle.abstractSyntaxTrees.types.TypeDenoter;
import triangle.abstractSyntaxTrees.visitors.VnameVisitor;
import triangle.syntacticAnalyzer.SourcePosition;
public abstract class Vname extends AbstractSyntaxTree {
public Vname(SourcePosition position) {
super(position);
variable = false;
type = null;
}
public boolean variable, indexed;
public int offset;
public TypeDenoter type;
public abstract <TArg, TResult> TResult visit(VnameVisitor<TArg, TResult> visitor, TArg arg);
public <TArg, TResult> TResult visit(VnameVisitor<TArg, TResult> visitor) {
return visit(visitor, null);
}
}