public bool isValid(string sourceCode) { Form1.errores = ""; Gramatica gramatica = new Gramatica(); LanguageData language = new LanguageData(gramatica); Parser parser = new Parser(language); ParseTree parseTree = parser.Parse(sourceCode); ParseTreeNode root = parseTree.Root; return(root != null); }
public static string analizar(String cadena) { Form1.errores = ""; Gramatica gramatica = new Gramatica(); LanguageData lenguaje = new LanguageData(gramatica); Parser parser = new Parser(lenguaje); ParseTree arbol = parser.Parse(cadena); ParseTreeNode raiz = arbol.Root; if (raiz == null)// || Form1.errores.CompareTo("") != 0) { return(Form1.errores); } return("Análisis exitoso!!"); }