[il-antlr-interest: 32657] [antlr-interest] New Guy Question...

2011-06-05 Thread George Spears
 

Hi everyone,

Just dipping my toes in the ANTLR waters do to speak..  In other words, I am
definitely new at this, so a couple quick questions.

1)   Is this list/email address the best way to ask questions?  

2)  Any idea when The Definitive ANTLR book will be updated?  It
appears to be based on 3.0, whereas the ANTLR product is 3.3. I still
purchased the book, and it is helping tremendously.

3)   My language of choice is Delphi.  Does anyone have a sample grammar
and the Delphi equiv of Test.java that they could send me.?  (George at woh
dot rr dot com)

4)  How do I handle case insensitivity?  For example, assume in the
following grammar that the token 'CALL' can be all caps, all lower letters,
or a mix.  How do I recognize it?

 

 

grammar T;

/** Match things like call foo; */

 

CALL  :   'CALL';

ID  :   ('a'..'z'|'A'..'Z')+ ;

INT :   '0'..'9'+ ;

NEWLINE:'\r'? '\n' ;

WS  :   (' '|'\t')+ { $channel=HIDDEN; } ;

MULT:   '*';

ASSIGN:   '=';

PLUS:'+';

MINUS:'-';

 

 

r : CALL ID ';' {System.out.println(invoke +$ID.text);} ;

 

 

 

 

Thanks,

George Spears

 


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: 32658] Re: [antlr-interest] New Guy Question...

2011-06-05 Thread Vinicius Durelli
Hi George,
I can properly answer most of your questions, as for the tougher/trickier
one I will

1) AFAIK, yes.
2) I think Terence has been working on it.
3) AFAIK, there is just a Pascal grammar. However, you'd better wait for the
veterans' reply.
4) I would solve this like that:

call : C A L L
  ;

fragment C :  ('c' | 'C');
fragment A :  ('a' | 'A');
fragment L :  ('l' | 'L');

I don't know if it is the best approach though.

Best regards,
Vinicius Durelli

On Sun, Jun 5, 2011 at 10:00 AM, George Spears geo...@woh.rr.com wrote:



 Hi everyone,

 Just dipping my toes in the ANTLR waters do to speak..  In other words, I
 am
 definitely new at this, so a couple quick questions.

 1)   Is this list/email address the best way to ask questions?

 2)  Any idea when The Definitive ANTLR book will be updated?  It
 appears to be based on 3.0, whereas the ANTLR product is 3.3. I still
 purchased the book, and it is helping tremendously.

 3)   My language of choice is Delphi.  Does anyone have a sample
 grammar
 and the Delphi equiv of Test.java that they could send me.?  (George at woh
 dot rr dot com)

 4)  How do I handle case insensitivity?  For example, assume in the
 following grammar that the token 'CALL' can be all caps, all lower letters,
 or a mix.  How do I recognize it?





 grammar T;

 /** Match things like call foo; */



 CALL  :   'CALL';

 ID  :   ('a'..'z'|'A'..'Z')+ ;

 INT :   '0'..'9'+ ;

 NEWLINE:'\r'? '\n' ;

 WS  :   (' '|'\t')+ { $channel=HIDDEN; } ;

 MULT:   '*';

 ASSIGN:   '=';

 PLUS:'+';

 MINUS:'-';





 r : CALL ID ';' {System.out.println(invoke +$ID.text);} ;









 Thanks,

 George Spears




 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: 32660] Re: [antlr-interest] Any way to search the ANTLR interest archives?

2011-06-05 Thread Bart Kiers
Hi George,

Sure, use Markmail: http://antlr.markmail.org/

http://antlr.markmail.org/Regards,

Bart.


On Sun, Jun 5, 2011 at 3:59 PM, George Spears geo...@woh.rr.com wrote:



 Hello,



 The ANTLR interest archives have a lot of valuable information in them..
 (http://www.antlr.org/pipermail/antlr-interest/ )  Is there any way to
 search them?  (Other than downloading everything to my local computer?



 If not, this would be a nice feature to have.



 Thanks,

 George Spears




 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: 32662] Re: [antlr-interest] New Guy Question...

2011-06-05 Thread Douglas Godfrey
You have to handle case insensitivity the hard way:

fragment A
:'A' | 'a';

fragment B
:'B' | 'b';

fragment C
:'C' | 'c';

fragment D
:'D' | 'd';

fragment E
:'E' | 'e';

fragment F
:'F' | 'f';

fragment G
:'G' | 'g';

fragment H
:'H' | 'h';

fragment I
:'I' | 'i';

fragment J
:'J' | 'j';

fragment K
:'K' | 'k';

fragment L
:'L' | 'l';

fragment M
:'M' | 'm';

fragment N
:'N' | 'n';

fragment O
:'O' | 'o';

fragment P
:'P' | 'p';

fragment Q
:'Q' | 'q';

fragment R
:'R' | 'r';

fragment S
:'S' | 's';

fragment T
:'T' | 't';

fragment U
:'U' | 'u';

fragment V
:'V' | 'v';

fragment W
:'W' | 'w';

fragment X
:'X' | 'x';

fragment Y
:'Y' | 'y';

fragment Z
:'Z' | 'z';

ADD :   A D D;
ALLOCATE  :   A L L O C A T E;
ALL  :   A L L;




On Sun, Jun 5, 2011 at 4:30 PM, Udo Weik weikeng...@aol.com wrote:

 Hello George,

  Just dipping my toes in the ANTLR waters do to speak..  In other words, I
 am
  definitely new at this, so a couple quick questions.

 my name is Udo, same situation.

  1)   Is this list/email address the best way to ask questions?

 Yep.

  2)  Any idea when The Definitive ANTLR book will be updated?  It
  appears to be based on 3.0, whereas the ANTLR product is 3.3. I still
  purchased the book, and it is helping tremendously.

 I bought both books from Terence and I hope that they will be updated, too.

  3)   My language of choice is Delphi.  Does anyone have a sample
 grammar
  and the Delphi equiv of Test.java that they could send me.?  (George at
 woh
  dot rr dot com)

 I'm a C++Builder user. Because I'm a hardware guy and due to some
 historical
 reasons, Delphi (Pascal) isn't MY programming language at all. But of
 course
 I'm interested to get ANTLR working with Delphi, too.

  4)  How do I handle case insensitivity?  For example, assume in the
  following grammar that the token 'CALL' can be all caps, all lower
 letters,
  or a mix.  How do I recognize it?

 At the moment, I'm still busy to get all my development tools working, so
 I can't help you with that ANTLR problem. What I have done so far:
 - Tried to get the C target language working with C++Builder
   - Problems with missing Object-files. That's an typical C++Builder-issue.
 I installed now Visual C++ 2010 Express, but no progress at the moment
 because my focus moved to Eclipse temporarily.
 - Eclipse
   - installed
   - ANTLR-plug in installed
   - Python-plug in PyDev installed

 When you look in the ANTLR interest archives (yep, I looked for an search
 option, too) you will find some questions related to C++Builder and Delphi
 from me. But until now no echo out of the universe.

 Pls. send me a PM, so we can discuss our further cooperation.


 Greetings
 Udo

 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: 32663] Re: [antlr-interest] New Guy Question...

2011-06-05 Thread Marco Hunsicker
 You have to handle case insensitivity the hard way:

 fragment A
  :'A' | 'a';

[...]

I don't think it's a necessity to do it this way. Actually, I think it 
would be better using a specialized input stream that does any necessary 
transformation. Your mileage may vary ;)

Cheers,

Marco

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: 32664] Re: [antlr-interest] Any way to search the ANTLR interest archives?

2011-06-05 Thread Luke A. Guest
On Sun, 2011-06-05 at 09:59 -0400, George Spears wrote:
 
 Hello,
 
  
 
 The ANTLR interest archives have a lot of valuable information in them..
 (http://www.antlr.org/pipermail/antlr-interest/ )  Is there any way to
 search them?  (Other than downloading everything to my local computer?

go to googly:

  input terms site:http://www.antlr.org/pipermail/antlr-interest/

Luke.




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: 32665] [antlr-interest] advices about phrase generation

2011-06-05 Thread Mauricio
hi all,

just wondering... about the org.antlr.tool.RandomPhrase source...
can someone help me to adapt it to generate a JMenu ? it should be something
like the image in syntax diagram window from antlrworks.. but navegable by
menus, so I can select a decision/path to follow, instead of the random one
used in that example.

cheers,
Mauricio Chicalski

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: 32666] Re: [antlr-interest] Error in the method specialStateTransition(int, IntStream)

2011-06-05 Thread preitz sharma
Hi Jim,
Thanks for the solution..
But I am facing one problem.

If I say

expr: SET VALUE ( i = Int  { setValue($i.getText());} |
v = SPL_CHARS+ {
displayErrorMessage($v.getText());})
   ;
SPL_CHARS  :  ('\U' .. '\U')+;

When I give some non numeric input and call the method
displayErrorMessage($v.getText()) , I get a null pointer exception. It says
that v is null.
What should I do?
I need to capture this value and display the error message..

PS: It is not a simple grammar for SET command. In our product, we are
migrating from manual parsing to ANTLR Parser. So I don't think it is an
over kill :)

On Fri, May 20, 2011 at 9:34 PM, Jim Idle j...@temporal-wave.com wrote:

 SPL_CHARS  :  ('\U' .. '\U')+;


 The '+' in this means match everything and keep matching everything. You
 cannot use + here, you need:

 SPL_CHARS  : .;

 Then use SPL_CHARS+ in your grammar not (.)+

 Though I think you would be better writing a small piece of code to
 process this really; ANTLR is a bit overkill for set x y

 Jim

  -Original Message-
  From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-
  boun...@antlr.org] On Behalf Of preitz sharma
  Sent: Friday, May 20, 2011 1:28 AM
  To: antlr-interest@antlr.org
  Subject: [antlr-interest] Error in the method
  specialStateTransition(int, IntStream)
 
  Hi,
  I need to develop a grammar with the following structure:
 
  set Param-Name Param-Val
 
  The grammar which I have developed is working fine except for one
  Problem:
 
  - If the Param-Val does not match the constraints defined for certain
  Param_Name, then I need to throw an error.
 
  I am doing it like this:
 
  command:SET ARRAYSIZE ( Int  {/*Process the arraysize*/}
  | (.)+ {/*Display eror message*/})
;
  Int:('0'..'9')+;
  Char:('a'..'z');
  SPL_CHARS  :  ('\U' .. '\U')+;
 
  The problem is that I am getting an error: The code of method
  specialStateTransition(int, IntStream) is exceeding the 65535 bytes
  limit
  What should I do?
  PS: The grammar which I have to write is pretty big.. If I make
  SPL_CHARS
  :  ('\U' .. '\U')  then its working fine Please suggest some
  solution..
 
  Thanks
  Preeti Sharma
 
  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




-- 
Regards
Preeti Sharma

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.