[antlr-interest] any interest in toy version of ST for learning purposes?
Terence Parr
parrt at cs.usfca.edu
Thu Oct 8 14:08:45 PDT 2009
Hi,
I'm in the process of rebuilding ST from the ground up. The previous
version works well, but it's hard for me to maintain because it uses a
tree-based interpreter. Further, it uses v2 ANTLR not v3. In order to
remove the dependencies in ST and in v3 itself on ANTLR v2, I'm
rebuilding both (though only the front end of ANTLR). The
functionality will be effectively the same, with some slight
differences in syntax. Lots of little things cleaned up and so on.
I'm working in my playground at the moment to create the core of the
new system before moving back into my repository. I have created a
very simple bytecode compiler and interpreter that handles the
canonical operations:
1. attribute reference: <name>, <user.id>
2. template inclusion: <searchbox(args)>
3. map template to attribute(s): <names:bold:italics>
4. conditional inclusion: <if(x)>foo<elseif(y)>bar<else>ick<endif>
The code seems pretty doggone clean to me. It's only when you start
dealing with separators and auto indentation and anchoring output
values, that the code becomes difficult to understand. I am about to
embark on that beast.
Should I cut this version out and make it an example? I don't have any
text describing how it works, but there are about 50 unit tests for
the compiler and interpreter. Would this be useful to people?
Ter
More information about the antlr-interest
mailing list