[il-antlr-interest: 23355] [antlr-interest] Tree Grammar: applying a multi-value to a string template

2009-04-24 Thread Florian Barth

Hi there!
I'm working on a tool that translates from my DSL to source code (e.g.  
Java). Being an AntLR rookie I was surprised of my good progress, but  
finally I ran into a problem that needs some experts' opinion :)
My language allows to define random distributions for certain values:
My parser generates an AST that looks like this: ^(UNIFORM ^(VALUES  
atom*)). Using output=template and the programming language specific  
templates I have the following problem:
In my tree grammar I have the following rule:   
^(UNIFORM  ^(VALUES (val+=atom)*))  
-> uniform(values={$val})
This matches perfectly and supplies the uniform-template with the  
according values. As the contained atoms need further parsing and  
rewriting I thought of inserting a nice ".st" into the rewrite rule:
-> uniform(values={$val.st})
I used this before for single values with great results. However in  
this case I need to further evaluate further rules for each element of  
the list and then hand it over to the template.
An example for these further computations would be the transformation  
of the separator in floats.

It would be great if somebody had an idea to help me :)

Regards,
Florian

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 il-antlr-interest@googlegroups.com
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~--~~~~--~~--~--~---



[il-antlr-interest: 23356] EARN $5000_$15000 PER MONTH WITHOUT INVESTMENT

2009-04-24 Thread ammu

EARN $5000_$15000 PER MONTH WITHOUT INVESTMENT

SIMPLE ONLINE SURVEYS AND EARN MORE

I HAVE EARN $1000 DAILY VIEW MORE DETAILS

*

http://www.AWsurveys.com/homemain.cfm?RefID=anusuyageetha

http://www.AWsurveys.com/homemain.cfm?RefID=anusuyageetha

http://www.AWsurveys.com/homemain.cfm?RefID=anusuyageetha


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



[il-antlr-interest: 23357] SEXY COLLEGE GIRLS HOT SEXY VIDEOS

2009-04-24 Thread rosean...@gmail.com

SEXY COLLEGE GIRLS HOT SEXY VIDEOS

http://kathriina.blogspot.com

http://kathriina.blogspot.com



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



[il-antlr-interest: 23358] EARN $5000-$15000 PER MONTH WITHOUT INVESTMENT

2009-04-24 Thread rosean...@gmail.com

EARN $5000-$15000 PER MONTH WITHOUT INVESTMENT

SIMPLE ONLINE SURVEYS AND EARN MORE

I HAVE EARN $1000 DAILY VIEW MORE DETAILS

**

http://www.AWSurveys.com/HomeMain.cfm?RefID=anusuyageetha

http://www.AWSurveys.com/HomeMain.cfm?RefID=anusuyageetha

http://www.AWSurveys.com/HomeMain.cfm?RefID=anusuyageetha

**

Online Dating and friend finder

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



[il-antlr-interest: 23359] [antlr-interest] maven plugin thinks grammar is up-to-date

2009-04-24 Thread Pete Siemsen
Just a gentle reminder - this is still broken.
I'm using plugin version 3.1.3-1.

-- Pete


 > > Pete Siemsen wrote:
 > > I'm using the new ANTLR3 maven plugin described at
 > > http://www.antlr.org/antlr3-maven-plugin/ Thanks to Jim Idle!
 > >
 > > The new plugin has a minor "feature" that the older plugin also  
had.
 > > If I edit my grammar and do "mvn package", maven doesn't detect  
that
 > > the grammar has changed.  Maven says "Grammar com/kyben/ 
translatecim/
 > > TranslateCIM.g is up to date - build skipped".  Doing "mvn clean;  
mvn
 > > package" makes maven process the grammar.  I've just gotten used to
 > > doing "mvn clean; mvn package", but I'm finally asking why I need  
the
 > > "mvn clean".
 > >
 > > -- Pete
 >
 > Hmmm, all that was tested and working, which means it must have been
 > broken just before we released it. I will look to see if I can fix it
 > easily.
 >
 > Jim

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-interest@googlegroups.com
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com
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


[il-antlr-interest: 23360] [antlr-interest] ANTLR + C Target Questions

2009-04-24 Thread Michael Coupland

Hi, I'm experimenting with using ANTLR to parse a custom file type,
and I have a few questions/comments about ANTLR and the C Target:


1) Consider the following grammar:

   grammar schema;

   options
   {
   language = C;
   }

   root : letter* ;
   letter : A | B ;
   other : C;

   A   :   'a';
   B   :   'b';
   C   :   'c';

If you run it on the input string "abc" in ANTLRWorks it generates a
NoViableAltException (as I would expect), but using the C Runtime to
parse a 'root' it passes successfully. (No errors reported, nothing
printed to stderr.) This seems like a bug at first glance, but I have
a sneaking suspicion that it's tied to the grammar - certainly, if you
were parsing a 'root' as a non-root rule, it shouldn't be an error if
it runs into a 'C'.
The only way I can think of to detect the above situation from C code
is to generates an AST and then examine it to see whether the parser
consumed the whole input stream. I was hoping to test
(retval.stop.type == ANTLR3_TOKEN_EOF), but that doesn't seem to ever
be true. What's the best thing to look at to determine this?
(retval.stop.stop, perhaps?)



2) The C Target generates many structs with members called "free"
which, while not technically a reserved word, isn't an ideal choice
for an indentifier name. There are codebases where free is #defined to
be something else, which can lead to problems in the generated code
that uses 'free' as a normal identifier. I haven't yet looked into
modifying the C target to solve this locally, which doesn't seem like
a huge task, but it would be nice if the default behavior were to use
some other less-overloaded identifier.



3) I can't seem to find documentation on how the C Target's error
handling works. Clearly the documentation at
http://www.antlr.org/wiki/display/ANTLR3/Error+reporting+and+recovery
isn't directly relevant. Where can I find more information about this?
Is there a good way to understand how the C Target emulates the Java
Target's use of exceptions, apart from reading generated code? There
don't seem to be any examples that deal with custom error reporting
using the C Target.



4) I was running into some problems with scope variables, and saw this
thread: http://www.antlr.org/pipermail/antlr-interest/2009-March/033769.html
but the link to http://antlr.org/downloads doesn't seem to work.
http://www.antlr.org/hudson/job/ANTLR_Tool/lastSuccessfulBuild/ seems
like a good place to get the latest development build, but I can't
seem to actually find a download link anywhere?


Thanks!
   Michael Coupland

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 il-antlr-interest@googlegroups.com
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~--~~~~--~~--~--~---



[il-antlr-interest: 23362] Re: [antlr-interest] ANTLR + C Target Questions

2009-04-24 Thread Jim Idle

Michael Coupland wrote:
> Hi, I'm experimenting with using ANTLR to parse a custom file type,
> and I have a few questions/comments about ANTLR and the C Target:
>
>
> 1) Consider the following grammar:
>
>grammar schema;
>
>options
>{
>language = C;
>}
>
>root : letter* ;
>   
root: letter* EOF;

No exceptions in C so that top rule can only set flags.
>
>
> 2) The C Target generates many structs with members called "free"
> which, while not technically a reserved word, isn't an ideal choice
> for an indentifier name. There are codebases where free is #defined to
> be something else, which can lead to problems in the generated code
> that uses 'free' as a normal identifier. I haven't yet looked into
> modifying the C target to solve this locally, which doesn't seem like
> a huge task, but it would be nice if the default behavior were to use
> some other less-overloaded identifier.
>   
Maybe, but as free is a function in every C runtime that I know of, 
#defining it in a system header file would break a lot more than the 
ANTLR runtime. Which system are you thinking of that #defines free? The 
trade off is the use of an intuitive method name vs something like 
'release' or 'close'.
>
>
> 3) I can't seem to find documentation on how the C Target's error
> handling works. Clearly the documentation at
> http://www.antlr.org/wiki/display/ANTLR3/Error+reporting+and+recovery
> isn't directly relevant. Where can I find more information about this?
>   
It  basically does the same thing as the other targets, but without 
exceptions.
> Is there a good way to understand how the C Target emulates the Java
> Target's use of exceptions, 
Well, it doesn't really.
> apart from reading generated code? There
> don't seem to be any examples that deal with custom error reporting
> using the C Target.
>   
Many past posts though:

http://markmail.org/search/list:antlr?q=C+displayRecognitionError

The docs at: http://antlr.org/api/C/index.html document 
displayRecognitionError which, just like in Java, is what you must 
override to implement your own error display. Also, I have commented 
that routine to death so that you can copy it and modify it to do what 
you need personally. Just read through the function.
>
>
> 4) I was running into some problems with scope variables, and saw this
> thread: http://www.antlr.org/pipermail/antlr-interest/2009-March/033769.html
> but the link to http://antlr.org/downloads doesn't seem to work.
> http://www.antlr.org/hudson/job/ANTLR_Tool/lastSuccessfulBuild/ seems
> like a good place to get the latest development build, but I can't
> seem to actually find a download link anywhere?
It is download rather than downloads. From hudson just click on the 
project. The first thing that comes up is a list of source code 
artifacts that you can download???

http://antlr.org/hudson/job/ANTLR%20C%20Runtime/

Jim

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 il-antlr-interest@googlegroups.com
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~--~~~~--~~--~--~---



[il-antlr-interest: 23363] Re: [antlr-interest] ANTLR + C Target Questions

2009-04-24 Thread Michael Coupland

> root: letter* EOF;
>
> No exceptions in C so that top rule can only set flags.

That change to the grammar works great, thanks! For reference, what
would I want to look at if I wanted to deduce what portion of the
input data the parser had consumed?


> Maybe, but as free is a function in every C runtime that I know of,
> #defining it in a system header file would break a lot more than the
> ANTLR runtime. Which system are you thinking of that #defines free? The
> trade off is the use of an intuitive method name vs something like
> 'release' or 'close'.

It's definitely a rarity, and something that you have to be very
careful about, but many performance-sensitive codebases do ugly/sneaky
things to hijack control of memory allocations throughout the system.
I know of at least one high-profile commercial game engine that
#defines free to be something else, and the MySQL SDK does this as
well. I understand the argument for intuitive names, but wouldn't
something like freeObject be equally intuitive, and less likely to
collide?


> The docs at: http://antlr.org/api/C/index.html document
> displayRecognitionError which, just like in Java, is what you must
> override to implement your own error display.

Ok, thanks. I had noticed displayRecognitionError, but wanted to make
sure there wasn't some other error-handling mechanism that I needed to
worry about as well.

I think it would be helpful if there were a brief mention of this
function on the front page of the C API - something as simple as "If
you want to hook a custom error handler, override
displayRecognitionError." (There is no instance of the
string "error" on that main page, which was the first thing I tried
searching for...)

(Also, as an aisde, the link to "displayRecognitionError" on
http://antlr.org/api/C/antlr3exception_8h.html appears broken.)


> It is download rather than downloads. From hudson just click on the
> project. The first thing that comes up is a list of source code
> artifacts that you can download???
>
> http://antlr.org/hudson/job/ANTLR%20C%20Runtime/

http://antlr.org/download looks very useful! Is there a link to this
page from the main ANTLR webpage? Most download links seem to point to
http://antlr.org/download.html , which is different...

For the C Runtime, yes, it's pretty easy to find the download in
Hudson, but I didn't know where to go in Hudson to get the specific
file you mentioned in the other email (
antlr-master-3.1.4-SNAPSHOT-completejar.jar )  - it's not 100% clear
which Hudson job it would belong to (probably ANTLR_Tool, though), and
there don't appear to be any downloadable artifacts at
http://antlr.org/hudson/job/ANTLR_Tool/

Thanks for your response, it was very helpful!


Michael

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 il-antlr-interest@googlegroups.com
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~--~~~~--~~--~--~---



[il-antlr-interest: 23364] Re: [antlr-interest] ANTLR + C Target Questions

2009-04-24 Thread Jim Idle




Michael Coupland wrote:

  
root: letter* EOF;

No exceptions in C so that top rule can only set flags.

  
  
That change to the grammar works great, thanks! For reference, what
would I want to look at if I wanted to deduce what portion of the
input data the parser had consumed?
  

Well, the EOF forces the parse to progress to the EOF 'token', so the
parser will look at everything, perform recovery resync and go on until
it sees the EOF, when it will finally breathe a sigh of relief ;-). You
override the error display (or a function earlier in that stack) and
collect the errors in a form that you can then use after parsing.
Generally, you don't print errors as they occur but collect them in a
log/buffer/collection/kitchen sink and then decide where they should go
after the parse is complete (I.E send to IDE, print to screen, email
them and so on).


  
Maybe, but as free is a function in every C runtime that I know of,
#defining it in a system header file would break a lot more than the
ANTLR runtime. Which system are you thinking of that #defines free? The
trade off is the use of an intuitive method name vs something like
'release' or 'close'.

  
  
It's definitely a rarity, and something that you have to be very
careful about, but many performance-sensitive codebases do ugly/sneaky
things to hijack control of memory allocations throughout the system.
I know of at least one high-profile commercial game engine that
#defines free to be something else, and the MySQL SDK does this as
well. I understand the argument for intuitive names, but wouldn't
something like freeObject be equally intuitive, and less likely to
collide?
  

Yeah - I think that one would just need to #undef free though to be
honest. I don't think that system headers ever override free, only
SDKs, so you know when and where to cope. Antlr does not use free, it
uses ANTLR3_FREE/MALLOC/CALLOC, so that you can predefine that and
build the runtime on systems that need something different. Really,
SDKs should do the same thing.

  

  
  
The docs at: http://antlr.org/api/C/index.html document
displayRecognitionError which, just like in Java, is what you must
override to implement your own error display.

  
  
Ok, thanks. I had noticed displayRecognitionError, but wanted to make
sure there wasn't some other error-handling mechanism that I needed to
worry about as well.
  

No. The advantage and disadvantage of the C runtime is that it is
pretty raw of course and you tend to have to know a bit more about the
internals than with the other targets (though not tons more). The Java
and C# versions are great and in fact I always protoype with one or the
other of these, but performance is an issue so tangling with the C is
worth it in the end if you need the speed. 

For instance, my T-SQL parser has 1100 regression tests and the timings
for parsing these and walking the tree look like this:

C

jimi(50_64)-clean: time tsqlc . >out
0.19user 0.15system 0:00.34elapsed 98%CPU (0avgtext+0avgdata
0maxresident)k
8inputs+232outputs (0major+102770minor)pagefaults 0swaps

Java

jimi(50_64)-clean: time tsql2005j . >out
2.33user 0.08system 0:02.05elapsed 117%CPU (0avgtext+0avgdata
0maxresident)k
0inputs+456outputs (0major+29634minor)pagefaults 0swaps


  
I think it would be helpful if there were a brief mention of this
function on the front page of the C API - something as simple as "If
you want to hook a custom error handler, override
displayRecognitionError." (There is no instance of the
string "error" on that main page, which was the first thing I tried
searching for...)
  

Hmm - that is supposed to be one of the first things in the "Using the
C runtime" page. I will check that out.

  
(Also, as an aisde, the link to "displayRecognitionError" on
http://antlr.org/api/C/antlr3exception_8h.html appears broken.)
  

I'll look at it. It looks like the process of copying the doxygen stuff
to the web site has thrown out relative links somehow.

  

  
  
It is download rather than downloads. From hudson just click on the
project. The first thing that comes up is a list of source code
artifacts that you can download???

http://antlr.org/hudson/job/ANTLR%20C%20Runtime/

  
  
http://antlr.org/download looks very useful! Is there a link to this
page from the main ANTLR webpage? Most download links seem to point to
http://antlr.org/download.html , which is different...

For the C Runtime, yes, it's pretty easy to find the download in
Hudson, but I didn't know where to go in Hudson to get the specific
file you mentioned in the other email (
antlr-master-3.1.4-SNAPSHOT-completejar.jar )  - it's not 100% clear
which Hudson job it would belong to (probably ANTLR_Tool, though), and
there don't appear to be any downloadable artifacts at
http://antlr.org/hudson/job/ANTLR_Tool/
  

I see what you are saying. You need to take the "Module Builds" link
from the last successful build page:

http://antlr.org/hudson/job/ANTLR_Tool/lastSuccessf