Tomas Potrusil wrote:
All 
Well, it isn;t exactly a huge laundry list ;-)
those problems remain there also for the latest builds (from May
21, version 3.1.4-SNAPSHOT)

add 1) Is there any hope that it will be fixed soon? Or can I write
that grammar any other way in order to achieve the similar
functionality?
  
They are on my list, but it will be at least 2 weeks out because I am traveling. Just do the same thing in action code -  I generally do that anyway as then I can comment it and make it clear what I am doing.  Using a wildcard is only saying match anything next, so just add the code as an action instead of using '. ', and rewrite whatever you get. Remember that the notation you are using in the grammar is just a way of telling the code generator what to generate; you can do anything you like manually.

add 2) The sample grammar is attached.
  
I'll take a look today all being well. Maybe I can fix quickly, otherwise it is two weeks out. Quite often people ask for a solution to something specific, when they mean "how should I go about xyz" :-) Thanks for the grammar though, which means I will have a fixable example.

Jim
Tom

2009/6/10 Jim Idle <[email protected]>:
  
Tomas Potrusil wrote:
    
Hello,

I've found the following bugs in the generated parser (C target):

1. This is the most annoying problem because I cannot solve it any
other way. My tree grammar is:
function:     ^(Function ^(DatabaseObject Nil COUNT) countArgument) ->
^(Function[$COUNT.text] countArgument);

The excerpt from generated code for this is:
pANTLR3_BASE_TREE root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR,
    (pANTLR3_BASE_TREE)ADAPTOR->createTypeText(ADAPTOR, Function,
(pANTLR3_UINT8)(COUNT162->getText(COUNT162))), root_1));

The COUNT162->getText(COUNT162) function returns pANTLR3_STRING which
is casted to pANTLR3_UINT8??? When I manually change the code to:
root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR,
    (pANTLR3_BASE_TREE)ADAPTOR->createTypeText(ADAPTOR, Function,
(pANTLR3_UINT8)(COUNT162->getText(COUNT162)->chars)), root_1));

      
I think that all of that is fixed in the 3.1.4 beta if you want to try
that, but there is a fundamental problem in that the Java target is
using overloaded functions to do this and I have no way at template
generation time to know what the intent was. Realistically, we need to
make the code generator call a different template or set a flag to say
which behavior it is expecting.
    
it works as expected.

2. My tree grammar doesn't do a lot. Because of that I wanted to
switch on rewriting (options {rewrite = true;}). But the generated
parser was not able to be compiled. Some variables were not defined,
getParent() function was called on ADAPTOR which doesn't contain
anything similar etc. (when I generated Java parser from that grammar
it was compiled correctly)

      
You probably need to send me an example please. Also, please verify that
this is the same with 3.1.4-beta as that sounds familiar.
    
3. The wildcard is not working for the C target! I reported that here
already that there was no response.
      
Sorry, but I have been busy earning a living lately. I am aware of this,
and am just not quite in sync with Java on that one. But, you can easily
do the same thing with an action code.
    
So once more. My tree grammar is
similar to:
func:    ^(FUNC arg=.) -> ^(Function $arg);

When I try to generate a parser a crazy error message appears that a
template rewriteWildcardLabelRef.st cannot be found. (again, for Java
everything works as expected)


      
I don't think that I am quite in sync with the Java target on rewrite of
wildcards. However, again, you can achieve this with a bit of action
code.  I will make sure that I have these bugs logged,

Jim

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address

    

List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to