[antlr-interest] Parse tree in the debugger

Andy Tripp antlr at jazillian.com
Wed Sep 24 10:03:36 PDT 2008


Loring Craymer wrote:
> Why hack?  Why not specify a DSL for the debugger/profiler/whatever and make the output conform.  That's a whole lot more maintainable over the long run.
> 
> --Loring
> 

In other words, make your famous quote more general:

"Why spend <X> <X_UNITS> writing it by hand when you can spend <Y> <Y_UNITS> automating it?"

...where in the original quote you had "5 days" and "5 years", now we have "5 minutes"
and "5 weeks" (5 minutes to just fix the space problem, or 5 weeks to invent a real DSL
for ANTLR-interacting tools).

And please, going forward, don't just write out plain English statements such as "Why spend 5 days...".
Instead, provide them as formal assertions in a formal language that can be added to the
appropriate ontology. This makes them much more useful and maintainable.

What's that? The suggestion is not to "automate" but rather to "create a new DSL?" Great!
Since you've creating this cute saying as a formal statement in a flexible DSL, we can replace
the word "automating" with a more general placeholder, which can have instantiations such
as "automating" or "creating a DSL for", etc. And then it's a simple matter to enhance
the semantic analysis to validate it. Isn't that a lot easier than just writing out
a plain English sentence?

There's really no job so small that a new DSL shouldn't be invented for it.
For example, I've now decided that just signing emails "Andy" is just not maintainable.
What if I change my name? What if people want to know my official name? What if people
want to see my name in their native language? So starting now, I'm going to sign
email in XML. I'll be publish the DTD along with a parser any day now.

<Signature>
  <Name language="English">
    <formalName>
         <first>Andrew</first>
         <middle type="initialOnly">H.</middle>
         <last>Tripp</last>
    </formalName>
    <nickname>Andy</nickname>
  </Name>
</Signature>


</snark>Andy ;)


More information about the antlr-interest mailing list