Gofer it
squeaksource: 'ASTBridge';
addPackage: 'ThothCompiler';
load
Then go to the Preference Browser (System->Preferences in the world menu) and choose ThothCompiler for the option "whichCompiler".
ThothCompiler allows you to use a modern AST in Pharo, rather than the 20 year old default one. The code is parsed with Lukas' really fast RBParser and then transformed to the 20 year old nodes, from there compiled. What's the advantage?
Well, you can transform the modern AST nodes before compilation! It has a great visitor API, that lets you do all kinds of transformations. You can use ThothCompiler as is just to feel fancy, or better: subclass it and overwrite the
transform:
method, in which you can transform the AST to your liking.ThothCompiler is now used in Helvetica (albeit under the name of
RBCompiler
, because things can never have enough names!).Changes since the last blog post:
- Now uses the RBParser, which is much faster than SmaCC
- No more dependency on the NewCompiler or AST package
- Adds a preference to the system (in the system menu), where you can choose the compiler, even when you can't compile anymore :)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.