Example #1
0
            public static Node.Program Parse()
            {
                Node.Program n;

                if (IsLookahead(1, Tokens.Terminator))
                {
                    n = null;  // empty program
                }
                else
                {
                    n = new Node.Program
                    {
                        E = Parser.Expression.Parse()
                    }
                };

                return(n);
            }
        }
Example #2
0
        public static Node.Program Parse(Lexer lex)
        {
            Parser.Lexer = lex;
            Parser.Log   = new Log();
            Node.Program tree = default(Node.Program);

            try
            {
                tree = Parser.Axiom.Parse();
            }
            catch (Exceptions.GenericException ex)
            {
                Console.BackgroundColor = ConsoleColor.Red;
                Console.ForegroundColor = ConsoleColor.Black;
                Parser.Log.Echo(ex.ToString());
                Parser.Log.Flush();
                Console.ResetColor();
            }
            return(tree);
        }
Example #3
0
 public static Node.Program Parse()
 {
     Node.Program program = Parser.Program.Parse();
     Match(Tokens.Terminator);
     return(program);
 }
Example #4
0
 private Types.Object EvaluateProgram(Node.Program node)
 {
     return(Evaluate(node.E));
 }