public static JsonObject DeserializeJsonObject(string Json) { Logger.Clear(); var CharStream = new CharacterStream(Json); var Lexer = new LexicalAnalyzer(CharStream); if (!Lexer.Analyzing()) { return(null); } var Parser = new SyntaxAnalyzer(Lexer.GetTokenStream()); if (!Parser.Analyzing()) { return(null); } var JsonNode = Parser.GetJsonNode() as SyntaxObjectNode; return(ParseJsonObjectFromNode(JsonNode)); }
public static T DeserializeObject <T>(string Json) where T : class, new() { Logger.Clear(); var CharStream = new CharacterStream(Json); var Lexer = new LexicalAnalyzer(CharStream); if (!Lexer.Analyzing()) { return(null); } var Parser = new SyntaxAnalyzer(Lexer.GetTokenStream()); if (!Parser.Analyzing()) { return(null); } var JsonNode = Parser.GetJsonNode() as SyntaxObjectNode; return(ParseObjectFromNode(typeof(T), JsonNode) as T); }
private static void Main(string[] Args) { var txt = File.ReadAllText("asm.txt"); var c = new CharacterStream(txt); var l = new LexicalAnalyzer(c, new LanguageDescriptionLite()); var e = l.Analyzing(); if (e.IsError()) { Logger.DError(e.Msg); } else { //l.Display(); } var s = new SyntaxAnalyzer(l.GetTokenStream()); e = s.Analyzing(); if (e.IsError()) { Logger.DError(e.Msg); } else { new Evaluator().Eval(s.GetProgramNode()); } Console.ReadLine(); /*var Eval = new Evaluator(); * while (true) * { * Console.Write(">"); * var Line = Console.ReadLine(); * if (string.IsNullOrWhiteSpace(Line)) * { * break; * } * * var l = new LexicalAnalyzer(new CharacterStream(Line), new LanguageDescriptionLite()); * var e = l.Analyzing(); * if (e.IsError()) * { * Logger.DError(e.Msg); * } * else * { * l.Display(); * } * * var s = new SyntaxAnalyzer(l.GetTokenStream()); * e = s.Analyzing(); * if (e.IsError()) * { * Logger.DError(e.Msg); * } * else * { * Eval.Eval(s.GetProgramNode()); * } * } * * Logger.DInfo("Done"); * Console.ReadLine();*/ }