-
Notifications
You must be signed in to change notification settings - Fork 1
/
CopyRestore.java
57 lines (49 loc) · 1.37 KB
/
CopyRestore.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
52
53
54
55
56
57
import Interpreter.*;
import viz.*;
import java.io.*;
public class CopyRestore
{
public static void main(String[] args)
{
System.out.println("Starting");
Global.InterpreterType = InterpreterTypes.BY_COPY_RESTORE;
BufferedReader br = null;
String name = "Samples/shell.src";
try
{
br = new BufferedReader(new FileReader(name));
}
catch (Exception e)
{
System.out.println("Eh?");
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();
for (String s : program.getPseudocode())
{
System.out.println(s);
}
XAALConnector xc = new XAALConnector(program.getPseudocode(), "Call by Copy-Restore");
QuestionFactory questionFactory = new QuestionFactory();
CopyRestoreInterpretVisitor iv = new CopyRestoreInterpretVisitor();
iv.setXAALConnector(xc);
iv.setQuestionFactory(questionFactory);
program.jjtAccept(iv, null);
String fileName = "by_copy_restore.xaal";
xc.draw(args[0]);
System.out.println("Visualization file created");
}
catch (Exception e)
{
System.out.println(e);
}
}
}