コード例 #1
0
    public virtual void Compile(StreamReader input, BytecodeStream output)
    {
        Scanner scanner = new Scanner(input);
        var     builder = new ProgramNodeBuilder();
        Parser  parser  = new Parser();

        parser.Parse(scanner, builder);

        RISCCodeGenerator generator = new RISCCodeGenerator(output);
        ProgramNode       parseTree = builder.GetRootNode();

        parseTree.Traverse(generator);
    }
コード例 #2
0
ファイル: facade.cs プロジェクト: possientis/Prog
 public void Compile(InputStream input, BytecodeStream output)
 {
     // creating scanner from InputStream
     Scanner scanner = new Scanner(input);
     // creating builder for abstract syntax tree
     ProgramNodeBuilder builder = new ProgramNodeBuilder();
     // creating Parser
     Parser parser = new Parser();
     // parsing using scanner and builder, hence creating AST
     parser.Parse(scanner, builder);
     // creating target code generator
     RISCCodeGenerator generator = new RISCCodeGenerator(output);
     // retrieving abstract syntax tree from builder
     ProgramNode parseTree = builder.GetRootNode();
     // generating target code from AST and generator
     parseTree.Traverse(generator);
     Console.WriteLine("compilation complete");
 }
コード例 #3
0
 public void Traverse(RISCCodeGenerator generator)
 {
 }
コード例 #4
0
ファイル: facade.cs プロジェクト: possientis/Prog
 public void Traverse(RISCCodeGenerator generator)
 {
     generator.Visit(this);
 }