Exemple #1
0
        public static void Main(string[] args)
        {
            preformSetUp(args);

            List <Token> tokens = new Lexer(options.Code).Tokenize();

            if (options.Debug)
            {
                Debug.PrintTokens(tokens);
            }
            Parser.Parser hassiumParser = new Parser.Parser(tokens);
            AstNode       ast           = hassiumParser.Parse();

            try
            {
                new Interpreter(new SemanticAnalyser(ast).Analyse(), ast).Execute();
            }
            catch (Exception e)
            {
                Console.WriteLine("ERROR: " + e.Message);
                Console.WriteLine("Press Y to show full stack trace");
                if (Console.ReadKey(true).Key == ConsoleKey.Y)
                {
                    Console.WriteLine(e);
                }
            }
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            preformSetUp(args);

            List<Token> tokens = new Lexer(options.Code).Tokenize();
            if (options.Debug)
                Debug.PrintTokens(tokens);
            Parser.Parser hassiumParser = new Parser.Parser(tokens);
            AstNode ast = hassiumParser.Parse();

            try
            {
                new Interpreter(new SemanticAnalyser(ast).Analyse(), ast).Execute();
            }
            catch (Exception e)
            {
                Console.WriteLine("ERROR: " + e.Message);
                Console.WriteLine("Press Y to show full stack trace");
                if (Console.ReadKey(true).Key == ConsoleKey.Y)
                {
                    Console.WriteLine(e);
                }
            }
        }