public List <C3D> compilar(String texto, RichTextBox consola, int lenguaje, String clase) { // *************** FASE 1 Analisis Lexico y Sintactico **************// if (lenguaje == (int)Pagina.Lenguaje.OLC) { // OLC++ InterpreteOLC interprete = new InterpreteOLC(); clases = interprete.analizarOLC(texto); clase = clase.Replace(".olc", ""); } else { // Tree InterpreteTree interprete = new InterpreteTree(); clases = interprete.analizarTree(texto); clase = clase.Replace(".tree", ""); } // **************** FASE 2 Llenar Tabla de Simbolos *****************// llenarTablaSimbolos(); // **************** FASE 3 Analisis Semantico y Codigo Intermedio ***// if (clases.Count > 0) { Clase main = buscarMain(clases[0]); if (main == null) { // Error! No hay procedimiento main en la clase de inicio! return(null); } GeneradorC3D.clases = clases; return(GeneradorC3D.generarC3D(main)); } return(null); }
private void btnConvertirCodigo_Click(object sender, EventArgs e) { // Convertir codigo a imagen if (tipoArchivo.SelectedIndex == 0) { // OLC InterpreteOLC interprete = new InterpreteOLC(); clases = interprete.analizarOLC(txtCodigo.Text); } else if (tipoArchivo.SelectedIndex == 1) { // Tree InterpreteTree interprete = new InterpreteTree(); clases = interprete.analizarTree(txtCodigo.Text); } else { MessageBox.Show("Seleccione un lenguaje!"); return; } relaciones = new List <Relacion>(); // Recorrer clases para buscar relaciones necesarias generarRelacionesUML(); repintar(); ejecutarGraphviz(); Thread.Sleep(1000); File.Delete(@"C:\Graphviz\Imagenes\imagen" + contadorImgs + ".txt"); this.imgDiagrama.Image = new System.Drawing.Bitmap(@"C:\Graphviz\Imagenes\nueva" + contadorImgs + ".png"); contadorImgs++; }