예제 #1
0
 public void ParserTest1()
 {
     Amil.Lexer     lexer     = Amil.Amil.AmilLexer;
     Amil.Parser    parser    = new Amil.Parser();
     Amil.Statement statement = parser.parse(lexer.Lex("{var a; if 0 { print true; }"));
     Console.WriteLine(statement.ToString());
 }
예제 #2
0
 public void ParserTest2()
 {
     Amil.Lexer     lexer     = Amil.Amil.AmilLexer;
     Amil.Parser    parser    = new Amil.Parser();
     Amil.Statement statement = parser.parse(lexer.Lex("{ print 1+2+3+4+5; }"));
     Console.WriteLine(statement.ToString());
 }
 public void VirtualMachineTest2()
 {
     Amil.Lexer          lexer  = Amil.Amil.AmilLexer;
     Amil.Parser         parser = new Amil.Parser();
     Amil.VirtualMachine vm     = new Amil.VirtualMachine(100);
     vm.LoadInstructions(parser.parse(lexer.Lex("{if false { print false; } print true; }")).Compile());
     vm.Execute();
 }