summaryrefslogtreecommitdiffstats
path: root/code/simpleSableCCCalulator/sableCCCalculator/Compiler.java
blob: 7430cfe3824e6c03b8d68efabdce20e5df5aada9 (plain)
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
package sableCCCalculator;
import sableCCCalculator.parser.*;
import sableCCCalculator.lexer.*;
import sableCCCalculator.node.*;
import java.io.*;

public class Compiler
{
    public static void main(String[] args)
    {
        try
        {
            System.out.println("Using source file: " + args[0]);
            // Create a Parser instance.
            Parser p = new Parser(new Lexer(new PushbackReader(new InputStreamReader(new FileInputStream(args[0])), 1024)));
            // Parse the input.
            Start tree = p.parse();
            // Apply the translation.
            tree.apply(new Translation());
            System.out.println("");
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
    }
}