home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
drdobbs
/
1988
/
06
/
may.exm
< prev
next >
Wrap
Text File
|
1979-12-31
|
896b
|
38 lines
Example 1: Source Code Recreation
Source Recreation
Object code Result
abc++ a+b+c
bcdfe+*/= let b=c/d*f+e
gabc+(*cd,,$ let g=sum(a*(b+c),c,d)
Example 2: Transformation Table
typedef struct decomp-row {
char ident
short lex_type;
char *prefix_1;
char *prefix_2;
char *suffix;
} decomp_row;
static decomp_row table[] ={
{`!', UNARY_OP, "-", NIL, NIL},
{`+', BINARY_OP, NIL, "+", NIL},
{`-', BINARY_OP, NIL, "-", NIL},
{`/', BINARY_OP, NIL, "/", NIL},
{`*', BINARY_OP, NIL, "*", NIL},
{`^' BINARY_OP, NIL, "^", NIL],
{`(', UNARY-OP, "(", NIL, ")"},
{`$', UNARY_OP, "sum(",NIL, ")"},
{`=', BINARY_OP, "let ","=", ";"},
{`,', BINARY_OP, NIL, ",", NIL}
};