The module [ptm_pp] supports some means for source-source-transformations. 1) It performs a tree-to-tree transformation based on the corresponding grammar specifications. It handles comments, too. source tree based on CFG 1 specification of CFG 2 --------------------------------------------> concrete target tree abstraction(CFG 1) = abstraction(CFG 2) based on CFG 2 regexp(token(CFG 1)) = regexp(token(CFG 2)) 2) It provides the pretty printing of parse trees. This is usefull after a transformation, because the target tree doesn't contain any position information. Note: This module is still under construction. The main things todo refer to the layout results which are some times broken and a mechanism for literal conversion. The interface functions are not reentrant. You cannot perform multiple transformations at a time.
Token separation types
#define PTP_SEP_NON 0 // none #define PTP_SEP_SPC 1 // space #define PTP_SEP_IND 2 // indent #define PTP_SEP_ROW 3 // row
void PTP_init(PLR_Tab tab) | initializes transformation and pretty printing based on parse table 'tab' as target grammar specification |
void PTP_quit(void) | terminates transformation and pretty printing |
void PTP_set_line(int len) | set 'len' as line length for pretty printing |
void PTP_tok_sep(symbol t_lft, symbol t_rgt, int sep) | specifies the kind of seperation ( 'sep' ) between the token 't_rgt' and 't_lft' |
void PTP_pp(PT_Term tree, FILE* fp) | performs pretty printing on parse term 'tree' ( output to file 'fp' ) |
PT_Term PTP_nt_transform_aux(PT_Term tree, symbol nt) | performs tree-to-tree transformation on source 'tree'; uses 'nt' as startsymbol |
PT_Term PTP_transform(PT_Term tree) | performs tree-to-tree transformation on source 'tree' |