[il-antlr-interest: 34518] [antlr-interest] how to deal with this function?

2011-10-23 Thread 李志鹏
hello all:

In my rule, I have a function named Between.

It has more than one parameters, the first is compare value, the next two
define a range, and next two next range, and so on. if only one parameter
left, it means the range has no upper limit.

such as:

Between(a, 1, 20, 25, 30), it means   (a1 and a20) or (a 25 and a30)
Between(a, 1, 20, 25)  it means  (a1 and a20) or (a 25)

I wonder how to describe it in rules, and how to describe it in Tree
grammar, and how to  build an AST tree, and how to deal it in tree walker.

thanks for your help.

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: 34522] Re: [antlr-interest] Getting names of lexer/parser rules from a Runtime

2011-10-23 Thread Udo Weik
Hello again Jim,

 Again, why do you want the NAMES of the rules? But there is no automated
 way to program this.

I want to use the C-runtime only as a wrapper, the actual code will be
executed in an event driven scripting engine. Therefore I must know
which rule triggered the event.

Many thanks and greetings
Udo


 -Original Message-
 From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-
 boun...@antlr.org] On Behalf Of Udo Weik
 Sent: Friday, October 21, 2011 4:45 AM
 To: antlr-interest@antlr.org
 Subject: [antlr-interest] Getting names of lexer/parser rules from a
 Runtime

 Hello,

 I already asked Jim that question concerning the C-Runtime.
 His answer:
 No - you have to code that. But they are rarely useful. If you want
 them  as indicators for error refinement, then implement a global
 scope and add  it to each rule, in the rule set a scope member
 variable to a predefined  value for each rule, then access the scope
 stack in the error reporting  method.

 So my question is - what is the simplest way to get these names? I'm
 working with complex grammars, so at least I want to automate adding
 necessary (action) code snippets (e. g. via Regex search and replace).
 Any other/better ideas?


 Many thanks and 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

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: 34524] Re: [antlr-interest] Jim Idle: C-Runtime, position of elements

2011-10-23 Thread Jim Idle
Look at the interface for CommonToken you can see that there is the
ability to get the line number (it assumes \n is the delimiter unless you
change that.


Jim



 -Original Message-
 From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-
 boun...@antlr.org] On Behalf Of Udo Weik
 Sent: Sunday, October 23, 2011 11:28 AM
 To: antlr-interest@antlr.org
 Subject: [antlr-interest] Jim Idle: C-Runtime, position of elements

 Hello Jim,

 my string looks like:
 012345
abcd
 pos (lexer) is 1

 012345
   abcd
 pos (lexer) is 0

 012345
 abcd
 pos (lexer) is -1

 Is that as it should be?

 And is there any way to get line/pos in the parser?
 I need this from all elements.


 Many thanks and 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: 34525] [antlr-interest] Release of C target 3.4 documentation

2011-10-23 Thread Kieran Simpson
Jim given you've released the 3.4 tarball, any timeline of when the 3.4 
documentation will be posted to http://www.antlr.org/api/C/index.html

Cheers,

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: 34526] Re: [antlr-interest] How to make the lexer thread-safe (C target)?

2011-10-23 Thread Kieran Simpson
Jim,
   What docs are you referring to?  I saw your example of @context and 
@apifuncs however I can't find what they mean.

My underlying query is to determine if the C target parsers are thread 
safe as I want to be able to parse multiple input sources concurrently.

Cheers,

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.