[il-antlr-interest: 28343] [antlr-interest] Parse assignments and method calls
Hello I have been working on the Java grammar, and in my opinion, there is a strange thing with the expressions. Actually the parser is able to detect an expression like : 1+2 = 3+4; or a = b+6 = c; And these are not legal statements in Java (it displays The left-hand side of an assignment must be a variable). This is detected later by the semantical analysis I guess, but I would like to modify the grammar to verify syntactically left hand-side variables. Here are my rules : statement: block| // others statements ...| affectation ';' | methodCall ';'| instanciation ';';affectation: affectMember+ methodAccess | affectMember+ 'new' identST arguments | affectMember+ expression; affectMember:varAccess assignmentOperator;varAccess: identST ('[' argument ']')*| members '.' identST ('[' argument ']')*| '(' varAccess ')'; members: 'this' ('.' member)*| 'super' ('.' member)*| instanciation ('.' member)*| member ('.' member)*| parMember ('.' member)*; parMember: '(' castMember? members ')' ; castMember: '(' primitiveType ')'| '(' type ')'; member: identST arguments ('[' argument ']')*| identST ('[' argument ']')*; methodAccess: methodCall| '(' castMember? methodAccess ')'; methodCall:'this' '.' (member '.')* methodMinimum|'super' '.' (member '.')* methodMinimum|instanciation '.' (member '.')* methodMinimum|(member '.')* methodMinimum|members '.' methodMinimum; methodMinimum: identST arguments; instanciation : 'new' creator ; expression: conditionalExpression; //. The code is not organized at all, but works, except when there is a castMember, as in : ((int)obj.method()).method2(); I think I have a problem with the parenthesis and their priorities. If anyone could help, I would appreciate it. I can't find things like these, nowhere. Parsers usually parse expression like in the Java.g grammar, but I need to parse this way. Thanks in advance.Dam. _ Hotmail et MSN dans la poche? HOTMAIL et MSN sont dispo gratuitement sur votre téléphone! http://www.messengersurvotremobile.com/?d=Hotmail 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: 28344] Re: [antlr-interest] Parse assignments and method calls
On Tue, Mar 23, 2010 at 2:56 PM, Damien Urruty lepila...@hotmail.comwrote: Hello I have been working on the Java grammar,... What is the Java grammar here? A ANTLR grammar you found on the net, or on one of ANTLR's wiki pages[1]? If so, you might want to tell which one (there's more than one on the wiki). Or do you mean the grammar from the JLS[2]? Regards, Bart. [1] http://www.antlr.org/grammar/list [2] http://java.sun.com/docs/books/jls/second_edition/html/syntax.doc.html 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: 28345] Re: [antlr-interest] Parse assignments and method calls
On Tue, Mar 23, 2010 at 2:56 PM, Damien Urruty lepi...@hotmail.comwrote: It's the Java Grammar 1.6 by Yang Jiang, but every grammar that I have encountered works the same way, the ones on the wiki, and Sun's one : a left-hand side variable can be a expression like 2+3... Hello I have been working on the Java grammar,... What is the Java grammar here? A ANTLR grammar you found on the net, or on one of ANTLR's wiki pages[1]? If so, you might want to tell which one (there's more than one on the wiki). Or do you mean the grammar from the JLS[2]? Regards, Bart. [1] http://www.antlr.org/grammar/list[2] http://java.sun.com/docs/books/jls/second_edition/html/syntax.doc.html _ Consultez gratuitement vos emails Orange, Gmail, Free, ... directement dans HOTMAIL ! http://www.windowslive.fr/hotmail/agregation/ 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: 28346] Re: [antlr-interest] Help request using updated antlrworks
I think this was a bug in the output template that was checked in when 1.3.1 was built and has since been corrected. Either expand ANTLRWorks replace the C.stg and repack, or build directly from source. However using the output = C in ANTLRWorks tends not to be useful ;-). I have always commented out the language= and just used remote debug. Anyway the problem is not your grammar. Please use the list rather than contacting me directly so other benefit from the answers. Thanks, Jim From: Rob Grapes [mailto:rob.gra...@ur.co.nz] Sent: Monday, March 22, 2010 9:12 PM To: j...@temporal-wave.com Subject: Help request using updated antlrworks Hi Jim, Sorry to contact you directly. I have an antlr grammar that works perfectly with antlrworks v1.1.7 using the C runtime. But since upgrading to v1.3.1. I get the following error: [17:08:29] error(10): internal error: C:\umajin2\Umajin1.g : java.util.NoSuchElementException: no such attribute: ASLabelType in template context [outputFile parser genericParser(...) rule ruleBlockSingleAlt alt rewriteCode rewriteAlt else_subtemplate rewriteElementList rewriteElement rewriteTree rewriteElement rewriteTree rewriteElement rewriteNodeActionRoot] 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: 28348] [antlr-interest] Q: Status of python (and other (non java) runtimes)
Hello all, I'm a relative newbe with antlr; have read most of the book and the website and done some experiments. Both with ANTLRWork and command line (yes I'm old fashioned:-) But, as I'm not a native-java expert I like to use one of the other languages. Most likely python. I have downloaded the (python) sources of antlr. runtime (dir: antlr.src-runtime-python/), added that to sys.path and give it a try. It complains about a version mismatch; which I fixed with changing the file 'antlr.src-runtime-python/__init__.py' WAS:__version__ = '3.1.3' BECOMES __version__ = '3.2.0' Now it runs ... In this experiment however, I use a simple checker only: the python- main only calls the lexer and the parser; no templates are used, no AST is build, no anything My questions: * Is the fix is did above correct. And should it work? Or is/should the runtime of v312 and 32.* really change. * Does the python runtime support AST, template and all other nice features, mentioned in the book? Or should I use another language option. The website mentions in is beta, but soon to change; but that was way back * If python is not really supported, which other languages are? Java, I assume;-) How about (ANSI) C, or C++? Or should I really stick to /learn java? Thanks for the answers. Thanks for the Tool PS, maybe it would help to put the status each langua on the website. Note: As I'm not (yet) part of this list, please BCC me! Note2, Sorry for posting to the wrong list first ... --Groetjes, Albert ALbert Mietus GSM: +316 16 531 258 Send prive mail to: ALbert at ons-huis dot net Don't send spam mail! Mijn missie: http://SoftwareBeterMaken.nl product, proces imago. Mijn leven in het kort:http://albert.mietus.nl/Doc/CV_ALbert.html 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: 28349] [antlr-interest] StringTemplate 3.2.1 with ANTLR 3.2
Hi list, I get some troubles with StringTemplate 3.2.1 and ANTLR 3.2 in Java. I get an error when I try to instanciate a StringTemplateGroup reporting that the antlr.TokenStream class doesn't exist... Is StringTemplate 3.2.1 compatible with ANTLR 3.2? Does a solution exist? Thanks! Fabien 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: 28350] Re: [antlr-interest] StringTemplate 3.2.1 with ANTLR 3.2
You're missing antlr-2.7.7.jar; v3 written in v2 Ter On Mar 23, 2010, at 10:48 AM, Fabien ANTOINE wrote: Hi list, I get some troubles with StringTemplate 3.2.1 and ANTLR 3.2 in Java. I get an error when I try to instanciate a StringTemplateGroup reporting that the antlr.TokenStream class doesn't exist... Is StringTemplate 3.2.1 compatible with ANTLR 3.2? Does a solution exist? Thanks! Fabien 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.