clase_14122009 - COMPILADORES ANALIZADOR SINTCTICO Ing....

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
COMPILADORES NALIZADOR SINTÁCTICO ANALIZADOR SINTÁCTICO Ing. EMIRO MUÑOZ JEREZ
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
EJERCICIO PRÁCTICO Hacer un programa en Visual C++, que permita implementar la siguiente gramática. <oracion> ::= <sujeto> <predicado> Ing. EMIRO MUÑOZ JEREZ <sujeto> ::= <frase sustantiva> <frase sustantiva> ::= <articulo> <nombre> <predicado> ::= <verbo> <complemento> <complemento> ::= <frase sustantiva> <articulo> ::= EL | LA | UN | UNA <nombre> ::= MONO | OSO | PLATANO | MIEL | HOMBRE | CERVEZA <verbo> ::= COME | TRAGA | BEBE
Background image of page 2
EJERCICIO PRÁCTICO El programa solo deberá aceptar frases como: EL MONO COME UN PLATANO UN OSO TRAGA LA MIEL Ing. EMIRO MUÑOZ JEREZ EL HOMBRE BEBE CERVEZA EL HOMBRE BEBE UNA CERVEZA UN HOMBRE BEBE LA CERVEZA Etc. .
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CODIGO EN C++ #include <stdlib.h> #include <stdio.h> #include <string.h> #define MAX_CADENA 80 #define MAX_TOKEN 30 #define TRUE 1 #define FALSE 0 Ing. EMIRO MUÑOZ JEREZ #define toupper(c) ((c) - 'a' + 'A') typedef unsigned char BYTE; enum genero_t{ GEN_MASCULINO , GEN_FEMENINO, GEN_INDETERMINADO }; enum genero_t gen_art, gen_nom; char cadena_ing[ MAX_CADENA ], car; char token[ MAX_TOKEN + 1 ] = "\0"; char *punt_car; char ant_token[ MAX_TOKEN + 1 ] = "\0"; /* Para poder regresar al */ char *ant_punt_car; /* punto anterior */ BYTE indicador;
Background image of page 4
// Prototipos void imprime( char * ); void oracion(); void sujeto(); void frase_sustantiva(); void predicado(); Ing. EMIRO MUÑOZ JEREZ void complemento(); void articulo(); void nombre(); void verbo();
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/01/2011 for the course SISTEMAS 2 taught by Professor Martinez during the Spring '11 term at Universidad Industrial de Santander.

Page1 / 15

clase_14122009 - COMPILADORES ANALIZADOR SINTCTICO Ing....

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online