[il-antlr-interest: 32607] [antlr-interest] Do you need an ANTLR programmer?
Hi, Do you need to write a new grammar? Or fix your grammar? Maybe your grammar needs testing? Here is a solution. It can be me. My name is Marton Papp. I have been working on converters/parsers since 2002. If you need more information or interested, write to mp at equinoxbase dot com. Let us see what we can do. (Note I am located in Europe.) Regards Márton Papp 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-inter...@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: 32608] [antlr-interest] options greedy : getting the tokens consumed during the greedy match
Hi - I am trying to parse a given java file, with a code fragment that consumes comments as below: ( Code fragment got from Java.g , pasted in the antlr site, to give credit where it is due). COMMENT @init{ boolean isJavaDoc = false; System.out.println(Entering comment); } : '/*' { if((char)input.LA(1) == '*'){ isJavaDoc = true; } } (options {greedy=false;} : . )* '*/' ... ; I am trying to get all the characters mapped by the wildcard regex , as in 'options greedy' line in the grammar file and get the string into the Java world for further processing. What hidden system variables/ grammar should I use to take care of the same ? 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-inter...@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: 32609] Re: [antlr-interest] Do you need an ANTLR programmer?
On Mon, May 30, 2011 at 9:23 PM, ante...@freemail.hu wrote: On 5/30/2011 11:20 PM, Bart Kiers wrote: On Mon, May 30, 2011 at 9:13 PM, ante...@freemail.hu wrote: On 5/30/2011 10:41 PM, Bart Kiers wrote: Could you stop spamming the ANTLR mailing list please? Bart. You may not know that but As I was worried that that this mail can be perceived as a spam, I asked Terence Parr if it is ok, if I send a mail here. To my surprise, he said yes. How could I know? You might have included that information from the get-go. I am sure that I am not the only one being annoyed by such messages. And are you planning to spam this mailing list on a regular basis? Or just once? Bart. Now you know. Sorry for not mentioning it in the mail.. (I considered it) I am not sure if you agree with me but if it is allowed, it cannot be called spam. Well, the over-all definition of spam is this: Spam is the use of electronic messaging systems [...] to send unsolicited bulk messages indiscriminately. It _is_ unsolicited since no one asked for it. You may have gotten approval from someone, but that doesn't mean it's not unsolicited. So yes, it sure is spam. At the moment, Just once now. I really hope so. If every self-employed developer starts spamming the list, it'd become a mess. Bart. PS. I cc-ed the list so that others are aware of the fact it's now okay to advertise one selves here. Márton [1] http://en.wikipedia.org/wiki/Spam_(electronic) 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-inter...@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: 32610] Re: [antlr-interest] Do you need an ANTLR programmer?
It always been OK, but there is obvious common sense involved, such as not posting such messages every week. For a start, I make a lot of my living writing professional ANTLR grammars and occasionally, you need to ask for work... which reminds me... But, in general I would shy away from appointing yourself unofficial arbitrator of the list. The list is basically whatever Ter says it is; the poster was polite enough to ask if it was OK to post and so that's that. Jim -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest- boun...@antlr.org] On Behalf Of Bart Kiers Sent: Monday, May 30, 2011 1:32 PM To: ante...@freemail.hu Cc: antlr-interest@antlr.org interest Subject: Re: [antlr-interest] Do you need an ANTLR programmer? On Mon, May 30, 2011 at 9:23 PM, ante...@freemail.hu wrote: On 5/30/2011 11:20 PM, Bart Kiers wrote: On Mon, May 30, 2011 at 9:13 PM, ante...@freemail.hu wrote: On 5/30/2011 10:41 PM, Bart Kiers wrote: Could you stop spamming the ANTLR mailing list please? Bart. You may not know that but As I was worried that that this mail can be perceived as a spam, I asked Terence Parr if it is ok, if I send a mail here. To my surprise, he said yes. How could I know? You might have included that information from the get-go. I am sure that I am not the only one being annoyed by such messages. And are you planning to spam this mailing list on a regular basis? Or just once? Bart. Now you know. Sorry for not mentioning it in the mail.. (I considered it) I am not sure if you agree with me but if it is allowed, it cannot be called spam. Well, the over-all definition of spam is this: Spam is the use of electronic messaging systems [...] to send unsolicited bulk messages indiscriminately. It _is_ unsolicited since no one asked for it. You may have gotten approval from someone, but that doesn't mean it's not unsolicited. So yes, it sure is spam. At the moment, Just once now. I really hope so. If every self-employed developer starts spamming the list, it'd become a mess. Bart. PS. I cc-ed the list so that others are aware of the fact it's now okay to advertise one selves here. Márton [1] http://en.wikipedia.org/wiki/Spam_(electronic) 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 il-antlr-inter...@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: 32611] Re: [antlr-interest] options greedy : getting the tokens consumed during the greedy match
Hi Vijay, You could grab all matched text in the `@after` block using the `getText()` method: COMMENT @init{ boolean isJavaDoc = false; System.out.println(Entering comment); } @after { System.out.println(Leaving comment, matched: + getText()); } : '/*' { if((char)input.LA(1) == '*') { isJavaDoc = true; } } (options {greedy=false;} : . )* '*/' ; Regards, Bart Kiers. On Mon, May 30, 2011 at 8:08 PM, Vijay Raj call.vijay...@yahoo.com wrote: Hi - I am trying to parse a given java file, with a code fragment that consumes comments as below: ( Code fragment got from Java.g , pasted in the antlr site, to give credit where it is due). COMMENT @init{ boolean isJavaDoc = false; System.out.println(Entering comment); } : '/*' { if((char)input.LA(1) == '*'){ isJavaDoc = true; } } (options {greedy=false;} : . )* '*/' ... ; I am trying to get all the characters mapped by the wildcard regex , as in 'options greedy' line in the grammar file and get the string into the Java world for further processing. What hidden system variables/ grammar should I use to take care of the same ? 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 il-antlr-inter...@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: 32612] Re: [antlr-interest] Do you need an ANTLR programmer?
On Mon, May 30, 2011 at 10:38 PM, Jim Idle j...@temporal-wave.com wrote: It always been OK, but there is obvious common sense involved, such as not posting such messages every week. For a start, I make a lot of my living writing professional ANTLR grammars and occasionally, you need to ask for work... which reminds me... But, in general I would shy away from appointing yourself unofficial arbitrator of the list. The list is basically whatever Ter says it is; the poster was polite enough to ask if it was OK to post and so that's that. Jim As I said: he could have posted that Terence gave him permission. Note that he send a message twice, in rapid succession. Bart. 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-inter...@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: 32613] Re: [antlr-interest] multi-channel token stream
Hello, This message is just to update the URL to the MultiChannelTokenStream class mentioned in the message below from some months ago. The current URL is: http://jiffle.googlecode.com/svn/trunk/language/src/main/java/jaitools/jiffle/parser/MultiChannelTokenStream.java Please feel free to do whatever you like with it, although I'd appreciate hearing about any bugs or ways of improving it. Alternatively, if it's entirely useless and there are much better ways of handling multiple channels I'd like to hear about that too :) Michael On 10 February 2011 10:59, Michael Bedward michael.bedw...@gmail.com wrote: Hi folks, I'd like my parser to be able to tune in to more than one token channel with the choice of channel(s) being set when constructing the TokenStream. The DAR book doesn't have an example of doing this, unless I've missed it. The wiki refers to being able to merge channels but I couldn't find an example of doing this - unless it just meant using BufferedTokenStream instead of CommonTokenStream ? My solution has been to create a simple class, MultiChannelTokenStream, adapted from CommonTokenStream. Instead of holding the index of a single channel it maintains a list of active channels which is used by the various stream access and positioning methods. The source is here: http://code.google.com/p/jai-tools/source/browse/trunk/jiffle/src/main/java/jaitools/jiffle/parser/MultiChannelTokenStream.java I still have a lurking doubt that I'm re-inventing the wheel here, ie. that I must be missing something obvious in the ANTLR API (or perhaps more fundamentally in lexer / parser design). If that's the case I'd appreciate any tips. On the other hand, if the class is of any use to others, please feel free to grab it. 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-inter...@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: 32614] [antlr-interest] suitability of Antlr for generating a PHP expression evaluator
Hi- I emailed the following to Terence Parr, and he suggested I ask the antlr-interest group. Any help the group can provide would be much appreciated. Can you help me determine whether Antlr is the right tool for the following situation? I built a Java-based survey tool in 2000, but can no longer support it, so I'm trying to port the key functionality of to LimeSurvey, which is written in PHP. My system has been supporting NIH-funded research for my epidemiologist colleagues - so these are really semi-structured diagnostic interviews that tend to range from 300-3500 questions. They are highly branched surveys, have internal scoring and complex branching logic (such as only asking follow-up questions if the person has a diagnosis of depression, meaning they acknowledged, via prior questions, 5 of 12 criteria for 2 weeks without other signs of non-psychiatric causes of the depressive behavior). The surveys are multi-lingual, and generate tailored reports for the patients and clinicians. I used JavaCC to build the expression parser I needed for my tool, and I'm totally stuck finding a well maintained compiler-compiler that will output PHP. Ideally, I'd like to write BNF or related notation and generate both PHP (for server-side calculations), and JavaScript (for client-side - e.g. to automatically update scale-scores on the form, and dynamically hide/show questions based upon relevance critieria). I've written expression evaluators and moderately sized languages in YACC, Bison/Flex, and JavaCC/JTree - so I'd much rather take that approach than having to hand-write a language parser and execution engine (had to do that 20 years ago, in C, to convert a C-like language to pseudo-assembly and run it on a stack-based, byte-code interpreter - I'd like to avoid going through that pain again :-)) Since Antlr is designed to output to other languages, it seems a natural fit for my need, but neither the JavaScript nor PHP output targets seem complete. On the other hand, I only need limited compiler-compiler functionality, so perhaps the JavaScript and PHP targets are good enough, but I can't assess that myself. The functionality I'm looking for here is very basic: (1) All basic math operators and functions (2) Ability to call other functions from a white list of supported functions (which would be included from an external source). At present, I categorize the functions by whether they take 0, 1, 2, 3, or unlimited arguments, so I can enforce a small degree of syntax checking. (3) Ability to handle numbers, strings, and dates separately (e.g. so can throw syntax exceptions if the a given math operator is not appropriate for a data type) (4) Only allowable syntax is supported (so can avoid calls to arrays, functions, hashes, macros, etc. - anything that might be unsafe or put the website at risk of an injection attack) (5) Only be able to reference known variables (each row of the survey has a unique variable name - so can only reference those variable names, thus avoiding accessing global parameters). So, there seem to be three options: (1) Find or build an equation parser that supports the functionality, and can evaluate those equations in PHP (and possibly JavaScript too). (2) Find or build an equation parser that can validate the syntax, but then let PHP and JavaScript's eval() functions actually evaluate the string (after replacing the variable and function names with lookup functions that retrieve the needed values from the PHP and JavaScript data stores). (3) Find or build an equation parser that can validate the syntax, but is a plug-able module or compiled shared library (e.g. a Windows .dll, or a *nix .so) which can be called from PHP, and be passed an array of allowable variable names and function syntax (so that it doesn't have to tightly couple with PHP). It seems that Antlr might work for option #1, provided that the PHP and JavaScript parser and evaluator targets are already stable (and well maintained) for the functionality I listed. For option #2, Antlr might work as long as the parser target is robust for PHP. I don't know enough about #3 to know how well Antlr would fit that strategy. Of course, Antlr may be overkill for the sort of task I'm listing here. Do you think Antlr is an appropriate tool for this? If so, which of those strategies do you recommend? If not, do you have any alternate recommendations? Thanks in advance for any advice you can provide. /Tom 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-inter...@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.