[il-antlr-interest: 31732] Re: [antlr-interest] [SPAM] [SPAM] Re: C# Target: Problems with Mono

2011-03-05 Thread Felix Natter
Olivier Lefevre lefev...@yahoo.com
writes:

 On 3/1/2011 10:00 PM, Felix Natter wrote:
 I am trying to generate C# code from my grammar for use with Mono2 (v1.9).
  
 ** (Antlr3.exe:4230): WARNING **: Missing method 
 System.Reflection.Emit.DynamicMethod::.ctor(string,Type,Type[])

 1) The Mono team is quite candid about what is missing:
 http://www.go-mono.com/status/ (System.Reflection can be found under 
 mscorlib)
 2) Mono 2.1.9 is ancient: the long-term and current stable versions
 are 2.6.7 and

Thanks for the hint. Yesterday I upgraded to Mono 2.6.7 (backport from
Debian squeeze, I haven't yet upgraded) and it seems I can now use the
CSharp3 target by loading the .sln in monodevelop (but I have yet to
test this more thoroughly).

But I am quite sure that the CSharp2 target in ANTLR 3.3 is broken
(but, as a last resort, the CSharp target in ANTLR 3.1 seems to work).

 2.10.1: http://www.go-mono.com/mono-downloads/download.html
 3) Has anyone run the ANTLR C# runtime through Moma, the Mono Migration 
 Analyzer?
 http://mono-project.com/Moma

That would be interesting.

Greetings,
-- 
Felix Natter


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: 31733] Re: [antlr-interest] [SPAM] [SPAM] Re: C# Target: Problems with Mono

2011-03-05 Thread Sam Harwell
The CSharp2 target is currently broken, but it's in the process of getting
fixed. The maintainer has been very busy, and it's been especially difficult
given the extra features I've recently added to the CSharp3 target which
aren't supported in C# 2.

Sam

-Original Message-
From: antlr-interest-boun...@antlr.org
[mailto:antlr-interest-boun...@antlr.org] On Behalf Of Felix Natter
Sent: Saturday, March 05, 2011 9:25 AM
To: antlr-interest@antlr.org
Subject: Re: [antlr-interest] [SPAM] [SPAM] Re: C# Target: Problems with
Mono

Olivier Lefevre lefev...@yahoo.com
writes:

 On 3/1/2011 10:00 PM, Felix Natter wrote:
 I am trying to generate C# code from my grammar for use with Mono2
(v1.9).
  
 ** (Antlr3.exe:4230): WARNING **: Missing method 
 System.Reflection.Emit.DynamicMethod::.ctor(string,Type,Type[])

 1) The Mono team is quite candid about what is missing:
 http://www.go-mono.com/status/ (System.Reflection can be found 
 under mscorlib)
 2) Mono 2.1.9 is ancient: the long-term and current stable versions
 are 2.6.7 and

Thanks for the hint. Yesterday I upgraded to Mono 2.6.7 (backport from
Debian squeeze, I haven't yet upgraded) and it seems I can now use the
CSharp3 target by loading the .sln in monodevelop (but I have yet to test
this more thoroughly).

But I am quite sure that the CSharp2 target in ANTLR 3.3 is broken (but, as
a last resort, the CSharp target in ANTLR 3.1 seems to work).

 2.10.1: http://www.go-mono.com/mono-downloads/download.html
 3) Has anyone run the ANTLR C# runtime through Moma, the Mono Migration
Analyzer?
 http://mono-project.com/Moma

That would be interesting.

Greetings,
--
Felix Natter


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: 31734] [antlr-interest] CSharp 2 - IToken::TokenIndex clarification

2011-03-05 Thread g...@novadsp.com


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: 31735] Re: [antlr-interest] Tree grammar for expression subrules?

2011-03-05 Thread Bart Kiers
On Fri, Mar 4, 2011 at 11:23 PM, g...@novadsp.com g...@novadsp.com wrote:


 On 04/03/2011 19:13, Bart Kiers wrote:

  I'd expect that to become the tree-grammar rule:

expression
   :  term
   |  ^(OR expression term)
   |  ^(OR expression EPSILON)
   ;


 Hello Bart

 Once again, extremely useful input. Thanks. My question though still
 stands. Cannot discern any pattern in writing the tree rules as, for
 example, this seems to violate cardinality ... or does it?



Hi, I'm starting to hesitate. Could you send your combined- or
parser-grammar that produces the AST? I'll have a look at it to see if I can
create a tree grammar (with a bit of comments).

Regards,

Bart.

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: 31736] [antlr-interest] Question about the cost of implementing case insensitivity in an Antlr Lexer

2011-03-05 Thread Douglas Godfrey
What is the relative cost for implementing case insensitive lexer tokens [as
shown below] versus case sensitive tokens?

// case sensitive keywords

GRAPH: 'GRAPH';
DIGRAPH: 'DIGRAPH';
STRICT: 'STRICT';
NODE: 'NODE';
EDGE: 'EDGE';
SUBGRAPH: 'SUBGRAPH';

// case-insensitive keywords

GRAPH: G R A P H;
DIGRAPH: D I G R A P H;
STRICT: S T R I C T;
NODE: N O D E;
EDGE: E D G E;
SUBGRAPH: S U B G R A P H;


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');

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: 31737] Re: [antlr-interest] Tree grammar for expression subrules?

2011-03-05 Thread Jim Idle
You write expressions like that in the following way:

expression
 : ^(OR expression expression)
 | term
 ;

term
 : X
 | Y
 | Z
 ;

Then do not create the UPSILON as it will just mislead you. if you feel
you need it then add it to term, which although allowing ^(OR EPSILION
EPSILON) won't happen because you won't produce that tree. However, don't
generally make a token for something that isn't there.

Jim

 -Original Message-
 From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-
 boun...@antlr.org] On Behalf Of Bart Kiers
 Sent: Saturday, March 05, 2011 9:09 AM
 To: g...@novadsp.com
 Cc: antlr-interest@antlr.org interest
 Subject: Re: [antlr-interest] Tree grammar for expression subrules?

 On Fri, Mar 4, 2011 at 11:23 PM, g...@novadsp.com g...@novadsp.com wrote:

 
  On 04/03/2011 19:13, Bart Kiers wrote:
 
   I'd expect that to become the tree-grammar rule:
 
 expression
:  term
|  ^(OR expression term)
|  ^(OR expression EPSILON)
;
 
 
  Hello Bart
 
  Once again, extremely useful input. Thanks. My question though still
  stands. Cannot discern any pattern in writing the tree rules as, for
  example, this seems to violate cardinality ... or does it?
 
 
 
 Hi, I'm starting to hesitate. Could you send your combined- or parser-
 grammar that produces the AST? I'll have a look at it to see if I can
 create a tree grammar (with a bit of comments).

 Regards,

 Bart.

 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: 31738] [antlr-interest] Tree construction rewrite rule error

2011-03-05 Thread Stephen Tuttlebee
Hi there,

I'm currently using the Java.g parser grammar (by Yang Jiang) from 
http://openjdk.java.net/projects/compiler-grammar/ and am trying to add 
tree construction rewrite rules and operators to build an AST. That's 
quite a job in itself (I'm trying roughly to base it on one I found in 
the mercurial repository on that site that contained actions that 
created a javac-style AST).

Anyway, my specific question relates to the LAST ALTERNATIVE in the 
following rule (from the expression hierarchy):

unaryExpressionNotPlusMinus
 :   TILDE unaryExpression - ^(BITWISE_COMPLEMENT unaryExpression)
 |   BANG unaryExpression - ^(LOGICAL_COMPLEMENT unaryExpression)
 |   castExpression
 |   {inHandlerDeclaration||inRunMethodDeclaration}?= 
inSynchronizationExpression // only allowed within handler declarations 
(which in turn are inside component definitions)
 |   primary - primary
 (selector - selector[$unaryExpressionNotPlusMinus.tree])*
 (   PLUSPLUS - ^(POSTINC $unaryExpressionNotPlusMinus)
 |   SUBSUB - ^(POSTDEC $unaryExpressionNotPlusMinus)
 )?
 ;

The last alternative does look a little complicated but it is basically 
creating a single tree from the 'primary' in case nothing else is 
matched (due to the * and ? that mean we could not match anything), 
while the subsequent rewrite rules (-) within the alternative are 
successively building up the tree by making the tree constructed thus 
far a child of a newly created tree (this is done by referencing the 
rule itself -- referencing $unaryExpressionNotPlusMinus in the context 
of a rewrite rule means take the current value of the tree of 
unaryExpressionNotPlusMinus).

However, when I run the grammar through ANTLR (3.3) I get the following 
errors:

error(100): /JavaBTranslator/src/JavaBPhase1SynSem1.g:1026:19: syntax 
error: antlr: expecting RPAREN, found '-'
  |--- (selector - selector[$unaryExpressionNotPlusMinus.tree])*

error(100): /JavaBTranslator/src/JavaBPhase1SynSem1.g:1027:22: syntax 
error: antlr: expecting RPAREN, found '-'
  |--- (   PLUSPLUS - ^(POSTINC $unaryExpressionNotPlusMinus)

error(10):  internal error: /JavaBTranslator/src/JavaBPhase1SynSem1.g : 
java.lang.NullPointerException
3 errors


It seems that ANTLR does not like the - that appear in the middle of 
the alternative for some reason. The problem could be a simple ANTLR 
syntax thing which I'm not clear about.

Anyone have any ideas about why I'm getting these errors.

Thanks,
Stephen

PS. also, it seems that coming up with the tree grammar rules to 
recognise the tree might be a little harder than constructing the tree 
in the parser, at least for the more complicated tree rewrite rules like 
this. But I'll have to cross that bridge when I come to it.

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: 31739] [antlr-interest] Yang's Java.g - tree construction rules

2011-03-05 Thread Stephen Tuttlebee
Hello

Does anyone know of a version of the Java.g written by Yang Jiang (see: 
http://openjdk.java.net/projects/compiler-grammar/ and 
http://www.antlr.org/grammar/1152141644268/Java.g) that performs tree 
construction using ANTLR's AST rewrite rules/construction operators 
(plus a tree grammar would be a bonus)?

I found a version of the Java.g parser that does tree construction of 
javac-style trees (required by the javac backend) using actions that 
created custom tree node objects (as opposed to using ANTLR's AST 
rewrite rules/construction operators (see: 
http://hg.openjdk.java.net/compiler-grammar/compiler-grammar/langtools/file/e37d7d5df672/src/share/classes/com/sun/tools/javac/antlr/Java.g).
 
I have started going through that grammar and used it to help me work 
out how to build the AST -- however, the code is quite long and I 
thought I'd check if anyone knew of a version of Java.g that contained 
ANTLR-style tree construction before I go any further -- I don't want to 
try to reproduce something that someone else might have already done and 
also likely done a better job at too.

Thanks,
Stephen

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: 31740] Re: [antlr-interest] Tree construction rewrite rule error

2011-03-05 Thread Jim Idle
You are just getting that because you need the rewrite at the end of an
alt or section:

| ( primary - primary)

 ...

Jim

 -Original Message-
 From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-
 boun...@antlr.org] On Behalf Of Stephen Tuttlebee
 Sent: Saturday, March 05, 2011 4:08 PM
 To: antlr-interest@antlr.org
 Subject: [antlr-interest] Tree construction rewrite rule error

 Hi there,

 I'm currently using the Java.g parser grammar (by Yang Jiang) from
 http://openjdk.java.net/projects/compiler-grammar/ and am trying to add
 tree construction rewrite rules and operators to build an AST. That's
 quite a job in itself (I'm trying roughly to base it on one I found in
 the mercurial repository on that site that contained actions that
 created a javac-style AST).

 Anyway, my specific question relates to the LAST ALTERNATIVE in the
 following rule (from the expression hierarchy):

 unaryExpressionNotPlusMinus
  :   TILDE unaryExpression - ^(BITWISE_COMPLEMENT unaryExpression)
  |   BANG unaryExpression - ^(LOGICAL_COMPLEMENT unaryExpression)
  |   castExpression
  |   {inHandlerDeclaration||inRunMethodDeclaration}?=
 inSynchronizationExpression // only allowed within handler declarations
 (which in turn are inside component definitions)
  |   primary - primary
  (selector - selector[$unaryExpressionNotPlusMinus.tree])*
  (   PLUSPLUS - ^(POSTINC $unaryExpressionNotPlusMinus)
  |   SUBSUB - ^(POSTDEC $unaryExpressionNotPlusMinus)
  )?
  ;

 The last alternative does look a little complicated but it is basically
 creating a single tree from the 'primary' in case nothing else is
 matched (due to the * and ? that mean we could not match anything),
 while the subsequent rewrite rules (-) within the alternative are
 successively building up the tree by making the tree constructed thus
 far a child of a newly created tree (this is done by referencing the
 rule itself -- referencing $unaryExpressionNotPlusMinus in the context
 of a rewrite rule means take the current value of the tree of
 unaryExpressionNotPlusMinus).

 However, when I run the grammar through ANTLR (3.3) I get the following
 errors:

 error(100): /JavaBTranslator/src/JavaBPhase1SynSem1.g:1026:19: syntax
 error: antlr: expecting RPAREN, found '-'
   |--- (selector - selector[$unaryExpressionNotPlusMinus.tree])*

 error(100): /JavaBTranslator/src/JavaBPhase1SynSem1.g:1027:22: syntax
 error: antlr: expecting RPAREN, found '-'
   |--- (   PLUSPLUS - ^(POSTINC $unaryExpressionNotPlusMinus)

 error(10):  internal error: /JavaBTranslator/src/JavaBPhase1SynSem1.g :
 java.lang.NullPointerException
 3 errors


 It seems that ANTLR does not like the - that appear in the middle of
 the alternative for some reason. The problem could be a simple ANTLR
 syntax thing which I'm not clear about.

 Anyone have any ideas about why I'm getting these errors.

 Thanks,
 Stephen

 PS. also, it seems that coming up with the tree grammar rules to
 recognise the tree might be a little harder than constructing the tree
 in the parser, at least for the more complicated tree rewrite rules
 like this. But I'll have to cross that bridge when I come to it.

 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.