Пример #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);
        }
    }
Пример #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);
        }
    }
Пример #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;
 }
Пример #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);
    }
Пример #5
0
 public void SetContext(YSInterpreter context)
 {
     Context = context;
 }
Пример #6
0
 public void SetContext(YSInterpreter context)
 {
     Context = context;
 }