[antlr-interest] 2.7.2a2 C# codegen...

Ric Klaren klaren at cs.utwente.nl
Fri Apr 5 01:00:24 PST 2002


On Thu, Apr 04, 2002 at 10:33:32PM -0000, micheal_jor wrote:
> 1. Should the classes that make up the runtime be .NET-tified or left 
> as is with Java conventions?  I'm referrring to the casing, use of 
> Properties as opposed to get/set methods etc

With C++ I'm more and more leaning to C++-ifying them. But this is mostly
because C++ has some more powerfull things to do some stuff (with
templates). Which in the end will be necessary for Unicode support (I
think). If the java way is enough like the .Net way then I would leave it
as java'ish as possible saves time in porting over new stuff/fixes from the
java mode.

> 2. Is there a way to check if _saveIndex will actually be used before 
> declaring it?. I delayed the declaration until first use but then the 
> more serious problem in [3] raised it's ugly head so, I regressed to 
> default behaviour.


> 3. Is there a way to ensure that _saveIndex is not redefined within a 
> nested scope/block. This is an error in C# unlike Java. A prefix or 
> suffix to make each declaration unique within all enclosing blocks 
> would be fine or, just reusing a single method-wide declaration if 
> there would be no interactions between it's various uses.

I think I kludged around something similar in the C++ codegen. Think I did
it with AST declarations. My fix is d*mn ugly though. We need a different
codegenerator setup.

My problem was that after delaying declarations, I sometimes hid a previous
declaration which yielded 'real usefull'(tm) trees. Look for genASTdecl and
needASTdecl func/vars in CppCodegenerator.java.

_saveIndex maybe tougher though to tackle. You may need to scan ahead in
grammar elements (eeiew)

> 5. I would like to allow the users to be able to specify a C# 
> namespace to be used by default for all the 
> lexers/parsers/treeparsers defined in a *.g file. I would also like a 
> per-lexer/parser/treeparser namespace declaration option that 
> overrides the default (if any) on a per-class basis:

There's some namespace stuff in the C++ mode. Dunno if it's usable for your
problem. Maybe it's possible to share some code between C++/C# mode.

> Finally, how do I get this into ANTLR?. Just mail it to Terrence is 
> it?

Good choice ;)

Cheers,

Ric
-- 
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- klaren at cs.utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
 'And this 'rebooting' business? Give it a good kicking, do you?' 'Oh, no,
  of course, we ... that is ... well, yes, in fact,' said Ponder. 'Adrian
    goes round the back and ... er ... prods it with his foot. But in a
     technical way,' he added. --- From: Hogfather by Terry Pratchett.


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list