Exemplo n.º 1
0
    public static void Main(string[] args)
    {
        String raw = "";

        try
        {
            using (StreamReader sr = new StreamReader("YSCode.ys"))
            {
                raw = sr.ReadToEnd();
            }
            YSLexer.DEBUG 		= true;
            YSRDParser.DEBUG	= true;
            YSInterpreter.DEBUG = true;
            YSStateModule.DEBUG	= true;

            YSRDParser parser = new YSRDParser (raw);
            if(parser.Parse() <= YSInterpreter.ERR_ACCEPT){
                YSInterpreter interpreter = new YSInterpreter (parser.PopLast());
                interpreter.Interpret();
            } else
                Console.WriteLine("Interpreter not started, parsing was aborted");
        }
        catch (IOException e)
        {
            Console.WriteLine("The file could not be read:");
            Console.WriteLine(e.Message);
        }
    }
Exemplo n.º 2
0
    public static void Main(string[] args)
    {
        String raw = "";

        try
        {
            using (StreamReader sr = new StreamReader("YSCode.ys"))
            {
                raw = sr.ReadToEnd();
            }
            YSLexer.DEBUG       = true;
            YSRDParser.DEBUG    = true;
            YSInterpreter.DEBUG = true;
            YSStateModule.DEBUG = true;

            YSRDParser parser = new YSRDParser(raw);
            if (parser.Parse() <= YSInterpreter.ERR_ACCEPT)
            {
                YSInterpreter interpreter = new YSInterpreter(parser.PopLast());
                interpreter.Interpret();
            }
            else
            {
                Console.WriteLine("Interpreter not started, parsing was aborted");
            }
        }
        catch (IOException e)
        {
            Console.WriteLine("The file could not be read:");
            Console.WriteLine(e.Message);
        }
    }
Exemplo n.º 3
0
 public static bool LPIProcess(ref YSStateModule state, string raw)
 {
     bool result = false;
     YSLexer lexer = new YSLexer(raw);
     YSRDParser parser = new YSRDParser (lexer.GetTokenList());
     if(parser.Parse() <= YSInterpreter.ERR_ACCEPT){
         YSInterpreter interpreter = new YSInterpreter (parser.PopLast());
         result = interpreter.Interpret(ref state);
     } else
         Console.WriteLine("Interpreter not started, parsing was aborted");
     return result;
 }
Exemplo n.º 4
0
    public static bool LPIProcess(ref YSStateModule state, string raw)
    {
        bool       result = false;
        YSLexer    lexer  = new YSLexer(raw);
        YSRDParser parser = new YSRDParser(lexer.GetTokenList());

        if (parser.Parse() <= YSInterpreter.ERR_ACCEPT)
        {
            YSInterpreter interpreter = new YSInterpreter(parser.PopLast());
            result = interpreter.Interpret(ref state);
        }
        else
        {
            Console.WriteLine("Interpreter not started, parsing was aborted");
        }
        return(result);
    }