[il-antlr-interest: 32623] Re: [antlr-interest] Random code generator

2011-06-01 Thread Terence Parr
hi. Ralf Lämmel has done good work inthis area.
Ter

On Jun 1, 2011, at 2:50 AM, The Researcher wrote:

 Hi Arturo,

 If you are referening to generating test phrases for input to your  
 parser,
 then

 Ter did a quick take on this.
 http://www.antlr.org/wiki/display/ANTLR3/Random+phrase+generation+using+an+ANTLR+grammar

 which will lead you to the RandomPhrase.java in the distribution  
 with the
 following note.

 NOTE: this does not work well for large grammars...it tends to  
 recurse too
 much and build really long strings.

 I did a quick search on the Internet with the requirements that it  
 be open
 source, free, documented and produced valid code for a compiler; I  
 found
 nothing. That doesn' t mean it doesn't exist, I just didn't find it..

 I am currently writing my own, but it is not based on any random  
 seed or
 statistics. It is designed to generate fully valid phrases for the  
 grammar.
 As a specific example, if I want to test method phrases in a class,  
 the
 methods will be wrapped in a class and be capable of being compiled,  
 it
 won't be a list of methods that need special code to test. One big  
 caveat
 with my program is that the grammar must be converted to BNF, which  
 means
 only two operators  ab  or  a | b, no ?, + or *.

 Eric

 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: 32625] [antlr-interest] Memory issue with ANTLR

2011-06-01 Thread Jayani Withanawasam
Hi,

 

I get a java.lang.OutOfMemoryError: (Java heap space) in ANTLR 3.3 and
ANTLR 3.1.3. (Project properties)

I need to increase the max heap size of the JVM.

 

So, I used the following command in Visual Studio pre-build event
command line:

 

java -cp
D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\ext
\ANTLR\lib\antlr-3.3-complete.jar -Xms32M -Xmx512M org.antlr.Tool
-message-format vs2005 -Xconversiontimeout 3
D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\Par
ser\tsqllexer.g
D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\Par
ser\tsql.g
D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\Par
ser\tsqlwalker.g

 

When I applied this I get namespace/ reference issues related to grammar
files.

Ex: 

The type or namespace name 'IAstRuleReturnScope' could not be found (are
you missing a using directive or an assembly reference?)
D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\Pars
er\tsql_tsqlcursors.cs  87569   Parser

 

Also, I tried following command in the command prompt.

 

Java -Xms32M -Xmx512M org.antlr.tool
D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\Par
ser\tsqllexer.g
D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\Par
ser\tsql.g
D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\Par
ser\tsqlwalker.g

 

There I got a timeout issue.

 

Is the given command incorrect? If so, what is the correct command I
should give to,

1.   Set the class path variable

2.   Increase the JVM heap size

 

Is there any other solution/ workaround for this time out issue?

Do you have any thoughts on this? Appreciate your help.

 

Regards,

Jayani 

 


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: 32626] Re: [antlr-interest] Memory issue with ANTLR

2011-06-01 Thread Mark Wright
Hi Jayani,

For the timeout issue you need to read the ANTLR documentation to find
out the command line parameter to the antlr tool to increase the timeout,
the default is too short for complex grammars.

Thanks, Mark

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: 32627] Re: [antlr-interest] Memory issue with ANTLR

2011-06-01 Thread Jayani Withanawasam
Thanks Mark,

The issue is the following command seems to be incorrect:

java -cp
D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\ext
\ANTLR\lib\antlr-3.3-complete.jar -Xms32M -Xmx512M org.antlr.Tool
-message-format vs2005 -Xconversiontimeout 3
D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\Par
ser\tsqllexer.g
D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\Par
ser\tsql.g
D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\Par
ser\tsqlwalker.g

The timeout is set to 3 here. But how to increase the max heap size
in this command?

Regards,
Jayani.


-Original Message-
From: Mark Wright [mailto:markwri...@internode.on.net] 
Sent: Wednesday, June 01, 2011 5:18 PM
To: Jayani Withanawasam; antlr-interest@antlr.org
Subject: Re: [antlr-interest] Memory issue with ANTLR

Hi Jayani,

For the timeout issue you need to read the ANTLR documentation to find
out the command line parameter to the antlr tool to increase the
timeout,
the default is too short for complex grammars.

Thanks, Mark

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: 32628] Re: [antlr-interest] Memory issue with ANTLR

2011-06-01 Thread Mark Wright
On Wed, 1 Jun 2011 17:24:21 +0530, Jayani Withanawasam jaya...@ecollege.com 
wrote:
 Thanks Mark,
 
 The issue is the following command seems to be incorrect:
 
 java -cp
 D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\ext
 \ANTLR\lib\antlr-3.3-complete.jar -Xms32M -Xmx512M org.antlr.Tool
 -message-format vs2005 -Xconversiontimeout 3
 D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\Par
 ser\tsqllexer.g
 D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\Par
 ser\tsql.g
 D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\Par
 ser\tsqlwalker.g
 
 The timeout is set to 3 here. But how to increase the max heap size
 in this command?
 
 Regards,
 Jayani.

Hi Jayani,

It looks like you may have already increased the max heap size with the
-Xms32M -Xmx512M options, I guess java does not care if its M or m for
megabytes, I use m, like:

java -Xmx512m -classpath $(ANTLR_CLASSPATH) org.antlr.Tool -Xconversiontimeout 
120 -report mygrammar.g

Anyway back in your first email, it looked like you sort of got past
that when running it in visual studio, and instead got this error:

 When I applied this I get namespace/ reference issues related to grammar
 files.

 Ex: 

 The type or namespace name 'IAstRuleReturnScope' could not be found (are
 you missing a using directive or an assembly reference?)
 D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\Pars
 er\tsql_tsqlcursors.cs  87569   Parser

But I don't know how to fix this error (I don't know if IAstRuleReturnScope is
something in your code or the C# ANTLR runtime).

Regards, Mark

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: 32629] Re: [antlr-interest] Memory issue with ANTLR

2011-06-01 Thread Jayani Withanawasam
Thanks Mark,

If I do not increase the max heap size, I will not get the reference
issues.
So, as you have mentioned, this can be something to do with the C# ANTLR
runtime and grammar files.

I tried the command you sent also.(To increase heap size) But still I
get the same error.

Regards,
Jayani.


-Original Message-
From: Mark Wright [mailto:markwri...@internode.on.net] 
Sent: Wednesday, June 01, 2011 6:01 PM
To: Jayani Withanawasam; antlr-interest@antlr.org
Subject: RE: [antlr-interest] Memory issue with ANTLR

On Wed, 1 Jun 2011 17:24:21 +0530, Jayani Withanawasam
jaya...@ecollege.com wrote:
 Thanks Mark,
 
 The issue is the following command seems to be incorrect:
 
 java -cp

D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\ext
 \ANTLR\lib\antlr-3.3-complete.jar -Xms32M -Xmx512M org.antlr.Tool
 -message-format vs2005 -Xconversiontimeout 3

D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\Par
 ser\tsqllexer.g

D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\Par
 ser\tsql.g

D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\Par
 ser\tsqlwalker.g
 
 The timeout is set to 3 here. But how to increase the max heap
size
 in this command?
 
 Regards,
 Jayani.

Hi Jayani,

It looks like you may have already increased the max heap size with the
-Xms32M -Xmx512M options, I guess java does not care if its M or m for
megabytes, I use m, like:

java -Xmx512m -classpath $(ANTLR_CLASSPATH) org.antlr.Tool
-Xconversiontimeout 120 -report mygrammar.g

Anyway back in your first email, it looked like you sort of got past
that when running it in visual studio, and instead got this error:

 When I applied this I get namespace/ reference issues related to
grammar
 files.

 Ex: 

 The type or namespace name 'IAstRuleReturnScope' could not be found
(are
 you missing a using directive or an assembly reference?)

D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\Pars
 er\tsql_tsqlcursors.cs  87569   Parser

But I don't know how to fix this error (I don't know if
IAstRuleReturnScope is
something in your code or the C# ANTLR runtime).

Regards, Mark

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: 32631] Re: [antlr-interest] Memory issue with ANTLR

2011-06-01 Thread Mark Wright
On Wed, 1 Jun 2011 18:43:31 +0530, Jayani Withanawasam jaya...@ecollege.com 
wrote:
 Thanks Mark,
 
 If I do not increase the max heap size, I will not get the reference
 issues.
 So, as you have mentioned, this can be something to do with the C# ANTLR
 runtime and grammar files.
 
 I tried the command you sent also.(To increase heap size) But still I
 get the same error.
 
 Regards,
 Jayani.

Hi Jayani,

Right so you still get this error:
 
  When I applied this I get namespace/ reference issues related to grammar 
  files.
 
  Ex: 
 
  The type or namespace name 'IAstRuleReturnScope' could not be found (are
  you missing a using directive or an assembly reference?)
 
 D:\Jay_CC\P4\user\brettp\SQLStandardsChecker\Ecollege\CodeStandards\Parser\tsql_tsqlcursors.cs
   87569   Parser

IAstRuleReturnScope sounds like it might be something in your
code, or in the C# code that was generated by the antlr tool
from the .g files, or maybe something in the C# antlr runtime.

You could try:

- checking the C# files generated from the antlr tool are linked into the
  application
- searching for IAstRuleReturnScope in the generated C# files, and in the .g
  files
- searching for IAstRuleReturnScope in the C# runtime
- searching for IAstRuleReturnScope in the string template files (.stg) for
  the C# runtime in the antlr tool source code

Actually its in there, maybe that gives some more hints:

% grep IAstRuleReturnScope **/*.stg
tool/src/main/resources/org/antlr/codegen/templates/CSharp2/AST.stg:, 
IAstRuleReturnScope\ASTLabelType\
tool/src/main/resources/org/antlr/codegen/templates/CSharp3/AST.stg:, 
IAstRuleReturnScope\ASTLabelType\
tool/target/classes/org/antlr/codegen/templates/CSharp2/AST.stg:, 
IAstRuleReturnScope\ASTLabelType\
tool/target/classes/org/antlr/codegen/templates/CSharp3/AST.stg:, 
IAstRuleReturnScope\ASTLabelType\
% 

Regards, Mark

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: 32637] Re: [antlr-interest] Accentuated chars in brazilian portuguese

2011-06-01 Thread Bart Kiers
Hi Nilo,

The grammar:

grammar Brasil;

parse
  :  WORD EOF
  ;

 WORD
   :  ('\u00c0'..'\u00ff' | 'a'..'z' | 'A'..'Z' | '-')+
   ;


parses the input não just fine in ANTLRWorks.

I'm not really familiar with C#, but for those who are, could you perhaps
post *how* you are testing it? (post a test rig that shows the behavior you
describe)

Regards,

Bart.



On Wed, Jun 1, 2011 at 10:53 PM, Nilo Roberto C Paim nilop...@gmail.comwrote:

 Hi all,

 I'm newbie using Antlr and I'm facing a problem when trying to parse a text
 that contains accentuated chars in Brazilian Portuguese.

 I've put a word definition on my grammar as follows:

WORD :  ( '\u00c0'..'\u00ff' | 'a'..'z' |
 'A'..'Z' | '-' )+ ;

 But have no success on parsing. Words like não (no in Portuguese)
 causes
 lexar throws Antlr.Runtime.NoViableAltException.

 I'm trying to use C#.

 Any hint?

 TIA

 Nilo, from Brasil...


 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: 32638] Re: [antlr-interest] Random code generator

2011-06-01 Thread Arturo Hernandez

Thank you both,

I did take a dive in the RandomPhrase.java
It looked like it relies on randomly falling into terminating rules to exit. If 
I read the code correctly. Makes sense that complex grammars would
Before I read your response I found Peter Maurer DGL. And it implements the 
features I mentioned and more. But I am not sure I want to dilute my learning 
at this point. I am learning ANTLR just so I can isolate my code from soo many 
language/framework/IDE options.
Before I read about Ralf's work. I wanted to mention a couple of ideas.
I thought some extra actions inside of a given ANTLR grammar could 
introduce bias. The actions sideffects could be picked up in the 
RandomPhrase.java code.
Also some high level constructs (patterns) could be added as rules, and 
an alternative head could be introduced for pseudorandom generation.Thanks 
again.
 From: pa...@cs.usfca.edu
 To: antlr-interest@antlr.org
 Date: Wed, 1 Jun 2011 08:52:53 +0200
 Subject: Re: [antlr-interest] Random code generator
 
 hi. Ralf Lämmel has done good work inthis area.
 Ter
 
 On Jun 1, 2011, at 2:50 AM, The Researcher wrote:
 
  Hi Arturo,
 
  If you are referening to generating test phrases for input to your  
  parser,
  then
 
  Ter did a quick take on this.
  http://www.antlr.org/wiki/display/ANTLR3/Random+phrase+generation+using+an+ANTLR+grammar
 
  which will lead you to the RandomPhrase.java in the distribution  
  with the
  following note.
 
  NOTE: this does not work well for large grammars...it tends to  
  recurse too
  much and build really long strings.
 
  I did a quick search on the Internet with the requirements that it  
  be open
  source, free, documented and produced valid code for a compiler; I  
  found
  nothing. That doesn' t mean it doesn't exist, I just didn't find it..
 
  I am currently writing my own, but it is not based on any random  
  seed or
  statistics. It is designed to generate fully valid phrases for the  
  grammar.
  As a specific example, if I want to test method phrases in a class,  
  the
  methods will be wrapped in a class and be capable of being compiled,  
  it
  won't be a list of methods that need special code to test. One big  
  caveat
  with my program is that the grammar must be converted to BNF, which  
  means
  only two operators  ab  or  a | b, no ?, + or *.
 
  Eric
 
  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
  

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: 32639] [antlr-interest] help

2011-06-01 Thread Omar Mohssen


hello
i have a problem using the grammar ANSI C ANTLR v3 grammar (on the link 
http://www.antlr.org/grammar/1153358328744/C.g) 
the problem is that i couldn't find the start state from which i start the 
interpreter to test examples like
void main(){

}
or any other simple examples ..
actually i don't know if this is exactly the problem i have the latest version 
of antlrworks i am getting FailedPredicateException... 
I appreciate any help 
thanks in advance

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: 32640] Re: [antlr-interest] help

2011-06-01 Thread John B. Brodie
Greetings!

On Wed, 2011-06-01 at 18:20 -0700, Omar Mohssen wrote:
 
 hello
 i have a problem using the grammar ANSI C ANTLR v3 grammar (on the link 
 http://www.antlr.org/grammar/1153358328744/C.g) 
 the problem is that i couldn't find the start state from which i start the 
 interpreter to test examples like
 void main(){
 
 }
 or any other simple examples ..
 actually i don't know if this is exactly the problem i have the latest 
 version 
 of antlrworks i am getting FailedPredicateException... 
 I appreciate any help 
 thanks in advance
 

I do not use ANTLRWorks so my advice may be bogus

Do not use the ANTLRWorks Interpreter -- it does not handle grammars
with predicates (and also apparently has other issues...)

Looks like the start symbol is translation_unit but that determination
is only after a very brief scan of the grammar (apparently, no rule
mentions EOF so it is kinda hard to tell...)

Hope this helps...
   -jbb



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.