Thursday, April 28, 2011

Drink Beer With Ear Infection

postfix infix parser

# Include (stdio.h)
# include (stdio.h) # include
(ctype.h)
# include (process.h)
# include (string.h)
# include (stdlib.h)


int pretesting;
void expr ();
void end ();
int match (int t);
void error ();

main () {

pretesting = getchar ();
expr ();
printf ("\\ nfinalizar?");

getch ();}


void expr () {

end ();
while (1)
if (look-ahead {
=='+')
; match
('+'); end ();
putchar ('+');
} else

if (pretesting =='-') {
match
('-'); term ();
putchar ('-');
} else

break;}


void finish () {
if (isdigit (pretesting)) {
putchar (pretesting);
; match (pretesting);
} else error ();}


int match (int t)

{if (t == pretesting)
pretesting = getchar ();
else error ();}


void error () {
printf ("Syntax Error ");}







0 comments:

Post a Comment