[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

What's the story with SableCC?

Hi folks,

I've been glancing through the emails as they rip past my email box.
I should probably dig and find the answer myself, but I'm way too busy.
Anyway, what's all the hubbub about?  Yet another parser generator
that can build trees?  What am I missing?  I'm sure it does it well, but
why the big arguments back and forth?  Sounds like they have some nice
action / grammar separation stuff, but...

I have only two comments:

1.  "Compiler-compiler" is and has always been a misnomer.

The most accurate description for most language tools is probably parser
compiler or parser generator with AST construction.  To say you built a compiler
for BASIC in 300 lines is very misleading.  What you have built is (I presume) a
simple BASIC (not VB) to bytecode (Java?) translator, which is a semester
undergraduate project even when you write it by hand completely.

I have lots of friends that build actual compilers (source to machine code) for
the various chip folks and they all tell me that the parser and tree constructor
is like 10% of their problem at most.

The attribute grammar folks etc... claim to build compilers with only one
description, but empirically I think we can safely say that it is not true. ;)

Enough about semantics...

2.  Just because you say "design pattern" doesn't mean it's good, correct, or

I have seen more and more of this "it uses design patterns...it must be good".
reminds me of the Dilbert cartoon where Dilbert is being interviewed because he
that his prediction program predicts we will all be captured and forced to work
in the
squirrel's nut mines.  He says "It's got real math!"  Kinda funny.

Depth first tree walkers and decorators or whatever fancy term people are using
days for a bit of recursion and action application aren't sufficient to solve
translation problems.

The most important question in translation is "What can you do with trees
when you get them?"  After building a million tree walkers by hand,
I built SORCERER and then incorporated the tree grammar stuff into
ANTLR itself.   Why would anybody do depth first search callbacks
when you can use a grammar to specify the structure of the tree and
when/where to do actions?  Even the gang of four book says that you should
use a mathematical description of a problem anytime you can.

After you've written as many giant (like 9 phase) source-level translators as I
you'll notice that grammars are a great way to manipulate trees.

In summary, your tool seems very nice (although you should have stayed away
from LALR(1) <wink>), but tree construction is a very small part of either a
real translator or a real compiler.  In the space of parser generators that can
trees and apply actions to nodes, welcome. :)

Best regards,