[stringtemplate-interest] ST/ANTLR debugging
Kay Roepke
kroepke at dolphin-services.de
Sat May 20 20:52:29 PDT 2006
Cheers, folks!
I'm currently contemplating taking a step back from the iterative fix-
and-run-and-fix-and-run v3 codegen development and began thinking
how the development process could be a bit less painful.
A couple of points that make trouble:
1) ActionTranslator.java of v3-fame uses a lot of templates from the
codegen template group and fills it with some obscure values from the
AST.
2) Stuff missing/buggy from the antlr.g grammar requires constant
rebuilding and painful reading of serialized trees.
3) Deciding which templates need which additional information is hard
to do, given the current layout of ActionTranslator (Ter wants to
rewrite that
beast anyway). Sometimes some I need information a points where
it is either not available yet, or only part of the information is
passed into the
templates. (The latest being rule return values, which appear in
a deeply nested scope, and thus aren't available in later actions,
due to wrong scoping.)
All told it is a rather unpleasant hack and hunt experience.
To make development easier, it would be helpful to have a decent
mechanism to write a debugger/analysis tool, which would allow me to see
1) the complete AST of the grammar as it is being parsed (and maybe
even set breakpoints)
2) each and every template used and attribute set as it is happening
(including callstacks from the Java files). This should include the
template source and
all attributes in a textual manner. Kinda hard for objects.
With this it would be possible to assemble a complete tree of
templates used and have all the attribue values available without
doing printf debugging.
Ideally this implementation would allow for some kind of step/break
mechanism and be platform agnostic. (Think sockets or so)
I already did a small proof-of-concept app for ST that is able to
trace simple attribute setting (for text/booleans) but it is closely
tied to the Mac. I wouldn't
propose to integrate this into ST but rather supply patch files and
the monitor app (to interested parties|online).
If no one is really interested in this, I'll just dash forward, but
it may appeal to some other folks, too.
v2 has some debugging capabilities (I think Scott Stanchfield did it)
but it didn't work for me and is also missing tree parser stuff,
AFAICS. This would be
extremely important, though.
Any ideas, comments?
-k
More information about the stringtemplate-interest
mailing list