Esempio n. 1
0
 public string TokenLiteral(MyProgram program)
 {
     if (program.Statements.Count > 0)
     {
         return(program.Statements[0].Program.TokenLiteral(program));
     }
     else
     {
         return("");
     }
 }
Esempio n. 2
0
        public MyProgram ParseProgram(Parser parser)
        {
            var program = new MyProgram();

            program.Statements = new List <Statement>();

            while (parser.CurrentToken.Type != TokenType.EOF)
            {
                var stmt = parser.ParseStatement(parser);

                if (stmt != null)
                {
                    program.Statements.Add(stmt);
                }
                parser.NextToken(parser);
            }

            return(program);
        }