Treehydra: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
|  (→GCC) |  (→GCC) | ||
| Line 9: | Line 9: | ||
| Emacs regexp to convert GTYs to attributes: | Emacs regexp to convert GTYs to attributes: | ||
|   ^\(typedef \)?\(struct\) \([^ ]+\) \(GTY[^{]+\) -> \1\2 \4 \3 |   ^\(typedef \)?\(struct\|union\) \([^ ]+\) \( *GTY[^{^J]+\) -> \1\2 \4 \3 | ||
| where ^J is C-q C-j | |||
| ===treehydra=== | ===treehydra=== | ||
Latest revision as of 19:16, 11 July 2008
Treehydra is a Dehydra_GCC extension to provide a low level view of the AST as it is seen in the GCC middle-end.
Building & Testing
GCC
Treehydra's C->JS conversion routines are generated by following the GCC's garbage collection GTY annotations on structs. Unfortunately, currently GTYs are not implemented as attributes and a separate parser is required for them. I patched GCC to rearrange GTY declarations on structs such that GTY can be defined as an attribute.
First configure/build GCC as specified in Dehydra build instructions
Emacs regexp to convert GTYs to attributes:
^\(typedef \)?\(struct\|union\) \([^ ]+\) \( *GTY[^{^J]+\) -> \1\2 \4 \3
where ^J is C-q C-j
treehydra
Build treehydra:
make CXX=~/gcc/bin/g++ gcc_treehydra.so
where CXX is the plugin-enabled compiler. It loads gcc_dehydra.so which generates C->JS conversion routines.
To test do
make PLUGIN=../gcc_treehydra.so tree -C test