-
Notifications
You must be signed in to change notification settings - Fork 1
/
ByReference.java
51 lines (42 loc) · 1.18 KB
/
ByReference.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import Interpreter.*;
import viz.*;
import java.io.*;
public class ByReference
{
public static void main(String[] args)
{
System.out.println("Starting");
Global.InterpreterType = InterpreterTypes.BY_REFERENCE;
BufferedReader br = null;
try
{
br = new BufferedReader(new FileReader("Samples/shell.src"));
}
catch (Exception e)
{
System.out.println(e);
}
VizParser parser = new VizParser(br);
try
{
ASTProgram program = (ASTProgram)parser.program();
RandomizingVisitor2<ByRefVariable> rv = new RandomizingVisitor2<ByRefVariable>(ByRefVariable.class);
program.jjtAccept(rv, null);
System.out.println("Successfully Parsed");
System.out.println("________________\n");
program.buildCode();
XAALConnector xc = new XAALConnector(program.getPseudocode(), "Call by Reference");
QuestionFactory questionFactory = new QuestionFactory();
ByRefInterpretVisitor iv = new ByRefInterpretVisitor();
iv.setXAALConnector(xc);
iv.setQuestionFactory(questionFactory);
program.jjtAccept(iv, null);
xc.draw(args[0]);
System.out.println("Visualization file created");
}
catch (Exception e)
{
System.out.println(e);
}
}
}