- Timestamp:
- Apr 16, 2018, 9:51:02 AM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
- Children:
- 32cab5b, 6040e67d, 9181f1d, f38e7d7
- Parents:
- 0a89a8f
- Location:
- tools/prettyprinter
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/prettyprinter/Makefile.am
r0a89a8f r81bb114 11 11 ## Created On : Wed Jun 28 12:07:10 2017 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Wed Jun 28 23:11:56 201714 ## Update Count : 1513 ## Last Modified On : Mon Apr 16 09:43:23 2018 14 ## Update Count : 20 15 15 ############################################################################### 16 16 -
tools/prettyprinter/lex.ll
r0a89a8f r81bb114 10 10 * Created On : Sat Dec 15 11:45:59 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Tue Aug 29 17:33:36 201713 * Update Count : 2 6812 * Last Modified On : Sun Apr 15 21:28:33 2018 13 * Update Count : 271 14 14 */ 15 15 … … 50 50 <INITIAL,C_CODE>"/*" { // C style comments */ 51 51 #if defined(DEBUG_ALL) | defined(DEBUG_COMMENT) 52 52 cerr << "\"/*\" : " << yytext << endl; 53 53 #endif 54 55 56 54 if ( YYSTATE == C_CODE ) code_str += yytext; 55 else comment_str += yytext; 56 yy_push_state(C_COMMENT); 57 57 } 58 58 <C_COMMENT>(.|"\n") { // C style comments 59 59 #if defined(DEBUG_ALL) | defined(DEBUG_COMMENT) 60 60 cerr << "<C_COMMENT>(.|\\n) : " << yytext << endl; 61 61 #endif 62 63 62 if ( yy_top_state() == C_CODE ) code_str += yytext; 63 else comment_str += yytext; 64 64 } 65 65 <C_COMMENT>"*/" { // C style comments … … 123 123 <C_CODE>"%}" { RETURN_TOKEN( RCURL ) } 124 124 125 ^"%union" { RETURN_TOKEN( UNION ) } 126 ^"%start" { RETURN_TOKEN( START ) } 127 ^"%token" { RETURN_TOKEN( TOKEN ) } 128 ^"%type" { RETURN_TOKEN( TYPE ) } 129 ^"%left" { RETURN_TOKEN( LEFT ) } 130 ^"%right" { RETURN_TOKEN( RIGHT ) } 131 ^"%nonassoc" { RETURN_TOKEN( NONASSOC ) } 132 ^"%precedence" { RETURN_TOKEN( PRECEDENCE ) } 125 ^"%define"[^\n]*"\n" { RETURN_TOKEN( DEFINE ) } 126 ^"%expect" { RETURN_TOKEN( EXPECT ) } 127 ^"%left" { RETURN_TOKEN( LEFT ) } 128 ^"%locations" { RETURN_TOKEN( LOCATIONS ) } 129 ^"%nonassoc" { RETURN_TOKEN( NONASSOC ) } 130 ^"%precedence" { RETURN_TOKEN( PRECEDENCE ) } 133 131 ^"%pure_parser" { RETURN_TOKEN( PURE_PARSER ) } 132 ^"%right" { RETURN_TOKEN( RIGHT ) } 134 133 ^"%semantic_parser" { RETURN_TOKEN( SEMANTIC_PARSER ) } 135 ^"%expect" { RETURN_TOKEN( EXPECT ) } 136 ^"%thong" { RETURN_TOKEN( THONG ) } 134 ^"%start" { RETURN_TOKEN( START ) } 135 ^"%thong" { RETURN_TOKEN( THONG ) } 136 ^"%token" { RETURN_TOKEN( TOKEN ) } 137 ^"%type" { RETURN_TOKEN( TYPE ) } 138 ^"%union" { RETURN_TOKEN( UNION ) } 137 139 138 "%prec" 140 "%prec" { RETURN_TOKEN( PREC ) } 139 141 140 {integer} 141 [']{c_char}['] 142 {identifier} 142 {integer} { RETURN_TOKEN( INTEGER ); } 143 [']{c_char}['] { RETURN_TOKEN( CHARACTER ); } 144 {identifier} { RETURN_TOKEN( IDENTIFIER ); } 143 145 144 146 <C_CODE>["]{s_char}*["] { // hide braces "{}" in strings … … 160 162 %% 161 163 void lexC(void) { 162 164 BEGIN(C_CODE); 163 165 } 164 166 165 167 string lexYacc(void) { 166 167 168 169 170 168 BEGIN(INITIAL); 169 //cerr << "CODE: " << endl << code_str << endl; 170 string temp( code_str ); 171 code_str = ""; 172 return temp; 171 173 } 172 174 -
tools/prettyprinter/parser.yy
r0a89a8f r81bb114 10 10 // Created On : Sat Dec 15 13:44:21 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Aug 29 16:34:10 201713 // Update Count : 10 4712 // Last Modified On : Sun Apr 15 21:40:30 2018 13 // Update Count : 1052 14 14 // 15 15 … … 61 61 %token<tokenp> CODE // C code 62 62 63 %token<tokenp> START // %start 64 %token<tokenp> UNION // %union 65 %token<tokenp> TOKEN // %token 63 %token<tokenp> DEFINE // %define 64 %token<tokenp> EXPECT // %expect 66 65 %token<tokenp> LEFT // %left 67 %token<tokenp> RIGHT // %right66 %token<tokenp> LOCATIONS // %locations 68 67 %token<tokenp> NONASSOC // %nonassoc 69 68 %token<tokenp> PRECEDENCE // %precedence 69 %token<tokenp> PURE_PARSER // %pure_parser 70 %token<tokenp> RIGHT // %right 71 %token<tokenp> SEMANTIC_PARSER // %semantic_parser 72 %token<tokenp> START // %start 73 %token<tokenp> THONG // %thong 74 %token<tokenp> TOKEN // %token 70 75 %token<tokenp> TYPE // %type 71 %token<tokenp> PURE_PARSER // %pure_parser 72 %token<tokenp> SEMANTIC_PARSER // %semantic_parser 73 %token<tokenp> EXPECT // %expect 74 %token<tokenp> THONG // %thong 76 %token<tokenp> UNION // %union 75 77 76 78 %token<tokenp> PREC // %prec 77 79 78 %token END_TERMINALS// ALL TERMINAL TOKEN NAMES MUST APPEAR BEFORE THIS80 %token END_TERMINALS // ALL TERMINAL TOKEN NAMES MUST APPEAR BEFORE THIS 79 81 80 82 %type<tokenp> sections 81 %token _SECTIONS83 %token _SECTIONS 82 84 %type<tokenp> mark 83 85 %type<tokenp> defsection_opt 84 %token _DEFSECTION_OPT86 %token _DEFSECTION_OPT 85 87 %type<tokenp> declarations 86 88 %type<tokenp> literalblock 87 %token _LITERALBLOCK89 %token _LITERALBLOCK 88 90 %type<tokenp> declaration 89 %token _DECLARATION91 %token _DECLARATION 90 92 %type<tokenp> union 91 93 %type<tokenp> rword 92 94 %type<tokenp> tag_opt 93 %token _TAG_OPT95 %token _TAG_OPT 94 96 %type<tokenp> namenolist 95 %token _NAMENOLIST97 %token _NAMENOLIST 96 98 %type<tokenp> nameno 97 %token _NAMENO99 %token _NAMENO 98 100 %type<tokenp> namelist 99 %token _NAMELIST101 %token _NAMELIST 100 102 %type<tokenp> name 101 103 %type<tokenp> rulesection 102 %token _RULESECTION104 %token _RULESECTION 103 105 %type<tokenp> rules 104 %token _RULE106 %token _RULE 105 107 %type<tokenp> lhs 106 %token _LHS108 %token _LHS 107 109 %type<tokenp> rhs 108 %token _RHS110 %token _RHS 109 111 %type<tokenp> prod 110 112 %type<tokenp> prec 111 %token _PREC113 %token _PREC 112 114 %type<tokenp> action 113 %token _ACTION115 %token _ACTION 114 116 %type<tokenp> usersection_opt 115 %token _USERSECTION_OPT117 %token _USERSECTION_OPT 116 118 %type<tokenp> ccode_opt 117 119 %type<tokenp> blocks … … 234 236 $$ = $1; 235 237 } 238 | DEFINE // bison 239 | LOCATIONS 236 240 | THONG // bison 237 241 ; -
tools/prettyprinter/test.y
r0a89a8f r81bb114 6 6 7 7 /* adsad2 */ 8 8 %locations 9 %define parse.error verbose 9 10 %% 10 11
Note: See TracChangeset
for help on using the changeset viewer.