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

new to sable



I like the type checking that sable produces. I might have to agree with others that the filtering of syntactic sugar from the ast might be nice. Do I really need the parens from a statement like "(" expression ")". I know that I can use ignored productions and then do a secondary pass but this is more likely to stress memory than doing it in a single pass and seems more readable.

In looking through the archive i noticed that someone wanted to be able to access the nodes via a enumeration. Why not just implement a single level tree walker that records who it visits. Or even a walker that that knows what to do on the nth item it visits.

One question I have is what value to the In and out methods. In overriding a caseXXX you can layer your code on either side of the call to the super method. 

caseXXX(){
yourInCodeXXX();
super.caseXXX();
yourInCodeXXX();
}

One problem that I had using the default implementaion is when my grammer changed the default implementation created default implementations for my changed productions. If instead it created implementations for caseXXXCallChildren and not the caseXXX itself then the compiler would have alerted me about my omision and i would still have a function that i could call and not have to memorize which child to call first. It could even be a callChildren method of the node itself and not of the walker.

One other question. Do you really need to synthise names for named alternatives. If you extended the package name wouldn't that do the same thing? You might have to put them in sub folders to prevent file name collision.