[il-antlr-interest: 32511] [antlr-interest] Automated BNF text combinations generator with constraints
I am sure this is an age old question and I did find some initial results on Google. I am looking for a program, preferably open source, that can generate all of the text combinations for a given BNF. Obviously the program should allow constraints to be set that limit such tings as number of characters in a variable, number of variables in a type, number of terms, etc. Specifically the grammar being tested is ISO 14882 2003, C++. If none are found, has anyone attempted this using PROLOG? Any comments or suggestions welcome. Thanks Eric. 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: 32513] Re: [antlr-interest] Collecting parameters
Hi David, Every root (or leaf) in the AST must be an instance of a ` org.antlr.runtime.tree.Tree`, so you can't create a node that is a `java.util.List`. By default, ANTLR creates its AST using `org.antlr.runtime.tree.CommonTree` objects which inherits the `getChildren()` method from `org.antlr.runtime.tree.BaseTree` which returns a List. This List contains `CommonTree`'s. So your VECTOR root already has a method to get the children `1,2,3,4`. Regards, Bart. On Sat, May 21, 2011 at 7:14 PM, David Smith david.sm...@cc.gatech.eduwrote: Your contributors have been very helpful with my novice questions, and I thank them. Here's another: I am trying to build an AST that processes text like: v4 = [1 2 3 4] The following rule works: term : (OPENB .+ CLOSEB) = OPENB vals CLOSEB - ^(VECTOR vals) |OPENB CLOSEB- EMPTY_VECTOR |DOUBLE |ID |'('! expr ')'! ; vals returns [List items] : vl+=expr (COMMA? vl+=expr)* {$items = $vl;} ; but it produces tree nodes like: (= v4 (VECTOR 1 2 3 4)) but I really want (= v4 (VECTOR values)) where 'values' is some kind of Java collection like an ArrayList. How do I do that? David M. Smith http://www.cc.gatech.edu/fac/David.Smith Georgia Institute of Technology, College of Computing Sent from my ASR-33 Teletype 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: 32514] Re: [antlr-interest] gUnit: Test of a parser rule always fail
Your lexer does not cater for spaces. Jim -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest- boun...@antlr.org] On Behalf Of Simon Marchi Sent: Friday, May 20, 2011 3:33 PM To: antlr-interest@antlr.org Subject: [antlr-interest] gUnit: Test of a parser rule always fail Hello ! I a trying to automatize the testing of my grammar using gUnit, but I ran into the following problem: when I try to test a parser rule, the input string is never recognized. The lexer rules can be tested without problem. I made a simple example to illustrate: Grammar file Cool.g: grammar Cool; options {language = Java;} @lexer::header {package a.b.c;} @header {package a.b.c;} // Parser rule fullName: FIRSTNAME LASTNAME; // Lexer tokens FIRSTNAME: 'SIMON'; LASTNAME: 'MARCHI'; gUnit file Cool.gunit: gunit Cool; @header {package a.b.c;} // The test case fullName: SIMON MARCHI OK Normally, the test case should pass, since the input is part of the grammar. I use the ANTLR plugin inside Eclipse, and pasting the input (SIMON MARCHI) in the interactive interpreter tells me that it is accepted by the rule fullName. However, the test fails. If I change from OK to FAIL, then the test passes (obviously). Is there anything I am doing wrong here ? Thank you, Simon 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.