[il-antlr-interest: 26808] Re: [antlr-interest] Equivalent of TOKEN{x,y}

2009-11-11 Thread Sam Harwell
Jim doesn't emphasize the benefits of doing things this way because by now we understand that this is just how things are done. If you relax checks like this in the grammar and place them in a post-parse analysis (tree walker for example), some of your benefits include: * Faster parsing

[il-antlr-interest: 26779] Re: [antlr-interest] Big grammar = static initializer/method size is exceeding the 65535 bytes limit

2009-11-10 Thread Sam Harwell
[...] I am rewriting all the grammars in v3 to be self hosted. Didn't Sam Harwell already do that for the C# port? 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

[il-antlr-interest: 26661] Re: [antlr-interest] Strange bug in ANTLR version higher than 3.1.2

2009-11-04 Thread Sam Harwell
Hi Franklin, You didn't say exactly what the bug was. That said, here's my feedback, lots of it just my opinion not rules: * Replace your call to {skip();} with {$channel = HIDDEN;} * Replace ^(PHO[i, pho] $i) with just PHO[i, pho]. When you construct the PHO token from i, it takes on the text

[il-antlr-interest: 26603] [antlr-interest] C# port binaries (CSharp3 target, StringTemplate, Tool, MSBuild integration)

2009-11-02 Thread Sam Harwell
a new grammar to the project, add a new Text File with the extension .g or .g3, and set its build action. You no longer have to manually add grammars by editing the project file. Finally, make sure you add a reference to the appropriate ANTLR runtime (CSharp2 or CSharp3). Thank you, Sam

[il-antlr-interest: 26612] [antlr-interest] C# Port Source Code (CSharp3 target, StringTemplate, Tool, MSBuild integration)

2009-11-02 Thread Sam Harwell
/antlr-dotnet-source-3.2.0.6288.7z Thank you, Sam Harwell --~--~-~--~~~---~--~~ 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-interest@googlegroups.com

[il-antlr-interest: 26495] Re: [antlr-interest] MSBuild integration for the CSharp targets

2009-10-24 Thread Sam Harwell
Hi Kyle, You can find them (the C# ports of StringTemplate and the Antlr Tool, along with the bootstrap binaries) under this folder: http://fisheye2.atlassian.com/browse/antlrcs/ Sam From: Kyle Ferrio [mailto:kfer...@gmail.com] Sent: Saturday, October 24, 2009 4:21 PM To: Sam Harwell

[il-antlr-interest: 26465] [antlr-interest] MSBuild integration for the CSharp targets

2009-10-23 Thread Sam Harwell
. I'll be re-packaging everything as a regular download in the near future. Thank you, Sam Harwell --~--~-~--~~~---~--~~ 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

[il-antlr-interest: 26409] Re: [antlr-interest] Status of the CSharp3 target and my C# portsof ANTLR and StringTemplate

2009-10-20 Thread Sam Harwell
[mailto:j...@temporal-wave.com] Sent: Tuesday, October 20, 2009 12:08 AM To: Sam Harwell; antlr-inter...@antlr.org; stringtemplate-inter...@antlr.org Subject: RE: [antlr-interest] Status of the CSharp3 target and my C# portsof ANTLR and StringTemplate OK - well we can add that easily enough J Why

[il-antlr-interest: 26394] Re: [antlr-interest] Status of the CSharp3 target and my C# portsof ANTLR and StringTemplate

2009-10-19 Thread Sam Harwell
, but most will want ot use the 'offical' java version of the tool even if they are targeting C#. Thanks for the updates, Jim From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Sam Harwell Sent: Monday, October 19, 2009 1:05 AM To: antlr-inter

[il-antlr-interest: 26370] Re: [antlr-interest] Which version do I need for a CSharp targetand VS 2008

2009-10-18 Thread Sam Harwell
Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Behalf Of C. Mundi Sent: Saturday, October 17, 2009 12:29 PM To: antlr-inter...@antlr.org Subject: Re: [antlr-interest] Which version do I need for a CSharp targetand VS 2008 Sam Harwell : I apologize

[il-antlr-interest: 26372] [antlr-interest] Status of the CSharp3 target and my C# ports of ANTLR and StringTemplate

2009-10-18 Thread Sam Harwell
Hi everyone, Here's a status update that I know many people are asking for. For each portion, I'll talk about the status of the code in Perforce. At the end, I'll talk about the status of the posted binaries. Basic Status StringTemplate and the ANTLR Tool: Up-to-date with the Java

[il-antlr-interest: 26151] Re: [antlr-interest] MSBUILD/Vs2008

2009-10-08 Thread Sam Harwell
: Gavin Lambert [mailto:an...@mirality.co.nz] Sent: Thursday, October 08, 2009 2:23 PM To: Sam Harwell; Jim Idle; antlr-inter...@antlr.org Subject: Re: [antlr-interest] MSBUILD/Vs2008 At 12:20 8/10/2009, Sam Harwell wrote: * Create a working Clean target (which carries over to Rebuild

[il-antlr-interest: 26133] Re: [antlr-interest] MSBUILD/Vs2008

2009-10-07 Thread Sam Harwell
I disabled the clean due to problems with P4 having the generated files readonly on disk. You can use it as a base for future improvements if you want. This forces the correct build order so you only have to build once (I included the import line just so you see where I placed it). This

[il-antlr-interest: 26134] Re: [antlr-interest] C++ grammar for ANTLR v3 ?

2009-10-07 Thread Sam Harwell
The only complete working grammar for ANTLR v3 written in ANTLR v3 is the set of grammars in my C# port, and they use the CSharp3 target. The C# port of the ANTLR tool uses these grammars internally for all its processing, so they are tested working. It would take a significant amount of work to

[il-antlr-interest: 25741] Re: [antlr-interest] ANTLR on Microsoft's Compact Framework?

2009-09-14 Thread Sam Harwell
Are you trying to run a generated parser, or are you actually trying to run Antlr3.exe on the CF to generate your parser? If you only want to run the generated parser, then you probably only need to compile Antlr3.Runtime.dll (CSharp3 target) or Antlr.Runtime.dll (CSharp/CSharp2 target). Sam

[il-antlr-interest: 25696] Re: [antlr-interest] Optimized code generation

2009-09-10 Thread Sam Harwell
In order of their effect, here are the things you'll want to do to improve speed. And when I say these are ordered, I mean there's a good chance that changing a lower bullet point without changing the ones above will have negligible results. * Left factor your grammar to remove the

[il-antlr-interest: 25371] Re: [antlr-interest] .NET Antlr3.Runtime Public Key Changed?

2009-08-20 Thread Sam Harwell
You'll need to reference both runtimes. I don't *think* there is a namespace conflict but if there is, here's how you have to resolve it: * Sign the assembly that references both ST 3.2 (my build) and the CSharp runtime (Johannes' build). That's the only way to get it to side-by-side load types

[il-antlr-interest: 25087] Re: [antlr-interest] VS 2008 build setup - Antlr is calledunnecessarily when grammar.g hasn't changed

2009-08-07 Thread Sam Harwell
My build does not exhibit this behavior (the generated files are only generated if they are out of date). I highlighted a section in the Target definition which clearly differs from the web page description and I know is used when checking for out-of-date dependencies. Here is a combined

[il-antlr-interest: 24932] Re: [antlr-interest] Approach to Multiple Passes using Tree Grammars without Filters (C#)?

2009-07-30 Thread Sam Harwell
Simply using a tree grammar won't alter the input tree. If you want customizable actions, use something like this: tokenSpec : TOKEN_REF {TrackToken($TOKEN_REF);} ; Then in your helper file (which you can create since the tree grammar class is declared partial in

[il-antlr-interest: 24792] Re: [antlr-interest] Rule methods are private (CSharp3 target)

2009-07-21 Thread Sam Harwell
) At 01:31 21/07/2009, Elnur Cabarov wrote: I use Antlr executable by Sam Harwell, but rule methods for CSharp3 target are private, so I can't call them externally Have you tried putting public in front of the rules you want to be callable? (This doesn't make any difference to the Java target

[il-antlr-interest: 24401] Re: [antlr-interest] Using ANTLR without Java

2009-06-28 Thread Sam Harwell
] On Behalf Of Sam Harwell Sent: Saturday, June 27, 2009 8:26 PM To: Gavin Lambert; Elnur Cabarov; antlr-inter...@antlr.org Subject: Re: [antlr-interest] Using ANTLR without Java I don't have a packaged release available, but the source in my branch is completely up-to-date with the Java branch. :) I

[il-antlr-interest: 24392] Re: [antlr-interest] Using ANTLR without Java

2009-06-27 Thread Sam Harwell
, and want a native solution, then you'll probably have to wait a while. IIRC Sam Harwell (the C# target maintainer) has done some work towards porting the whole of ANTLR (including the compiler) to C#. But it's still all pre-release. List: http://www.antlr.org/mailman/listinfo/antlr

[il-antlr-interest: 24209] Re: [antlr-interest] CSharp GeneratedCode attribute

2009-06-14 Thread Sam Harwell
FxCop freaks out on ANTLR generated code right now and slows down so much it's effectively unusable. I've been meaning to address this issue in the CSharp3 target, but haven't yet. I'm curious how you're supposed to handle partial classes with the GeneratedCode attribute - I assume I have to

[il-antlr-interest: 24132] Re: [antlr-interest] packrat vs. LL(*)

2009-06-08 Thread Sam Harwell
[I read the rest of this thread as well.] The backtrack=true option *destroys* the ability to provide useful error messages. A backtrack+memoize grammar is *much* less efficient in both time and space than a left-factored grammar written for ANTLR with these in mind. The options are potentially

[il-antlr-interest: 23980] Re: [antlr-interest] ocaml target?

2009-06-02 Thread Sam Harwell
I pondered the idea of an F# target a while back, but I quickly realized I was in over my head. For academic reasons I'd be very interested in the result if you do build an ocaml target. :) Sam -Original Message- From: antlr-interest-boun...@antlr.org

[il-antlr-interest: 23865] [antlr-interest] Syntax highlighting and performance possibilities

2009-05-22 Thread Sam Harwell
As I mentioned once in the past, I've been working on improving lexer performance for applications where the full information/features in Lexer/CommonToken is not required. A key example is syntax highlighters which have strict performance requirements and must be updated as a person types. I'll

[il-antlr-interest: 23869] Re: [antlr-interest] [antlr-dev] Syntax highlighting and performance possibilities

2009-05-22 Thread Sam Harwell
a flyweight token, but again it can only be used as long as you don't need more information than it's able to store. Sam From: George Scott [mailto:george.sc...@gmail.com] Sent: Friday, May 22, 2009 4:09 PM To: Sam Harwell Cc: antlr-inter...@antlr.org; antlr-...@antlr.org Subject: Re: [antlr-dev

[il-antlr-interest: 23827] Re: [antlr-interest] Unnecessary Java output file diffs

2009-05-20 Thread Sam Harwell
I wanted to make an option that doesn't include the timestamp and line number in the generated file, but I couldn't think of a name for it. Anyone have any suggestions? Sam From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Tom Ball Sent:

[il-antlr-interest: 23831] Re: [antlr-interest] Unnecessary Java output file diffs

2009-05-20 Thread Sam Harwell
] Sent: Wednesday, May 20, 2009 2:47 PM To: Terence Parr Cc: Sam Harwell; antlr-inter...@antlr.org Subject: Re: [antlr-interest] Unnecessary Java output file diffs Terence Parr wrote: All you have to do is alter the line in Java.stg template file. We could add an action variable like @members

[il-antlr-interest: 23710] Re: [antlr-interest] unreachable catch block

2009-05-14 Thread Sam Harwell
rule : something ; catch[ExceptionType e] { stuff... } finally { more stuff... } -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Warren Falk Sent: Thursday, May 14, 2009 5:11 PM To: Terence Parr Cc:

[il-antlr-interest: 23616] Re: [antlr-interest] AST rewrite bug C# target

2009-05-08 Thread Sam Harwell
You should always reference rule arguments and return values with a $, as in $ids. I'm thinking about making a mode that mangles the names of items that aren't meant to be accessed directly, which is required for some optimization work I've been planning. Sam From:

[il-antlr-interest: 23620] Re: [antlr-interest] AST rewrite bug C# target

2009-05-08 Thread Sam Harwell
I know at least the CSharp2 target supports generics there. :) Sam -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Jim Idle Sent: Friday, May 08, 2009 2:06 PM Cc: ANTLR Subject: Re: [antlr-interest] AST rewrite bug C#

[il-antlr-interest: 23578] Re: [antlr-interest] language design

2009-05-07 Thread Sam Harwell
While this is somewhat true of Java, it's really not true of C#. The built-in primitive types in both languages (int, short, double, char, bool) are passed by value in function calls and kept on the stack as local variables. The process of boxing in both languages takes a primitive type and wraps

[il-antlr-interest: 23522] Re: [antlr-interest] Check individual stmt?

2009-05-05 Thread Sam Harwell
Hi Bill, If the identifiers are uniquely determined by the lexer, you'll gain a significant performance advantage by something like this: for ( Token token = lexer.nextToken(); token != null; token = lexer.nextToken() ) { if ( token.getType() == Token.EOF ) break; if ( token.getType()

[il-antlr-interest: 23525] Re: [antlr-interest] Skip subtree in tree grammar

2009-05-05 Thread Sam Harwell
Hi Martijn, The state stack is unreliable in combination with semantic predicates and cannot be used in that manner. Instead you should use a construct like . or ^(IF .*) to skip the subtree in your walker. Sam -Original Message- From: antlr-interest-boun...@antlr.org

[il-antlr-interest: 23471] Re: [antlr-interest] C# code generation errors

2009-05-01 Thread Sam Harwell
Hi Bill, In the 'expr' rule, you have the following action that is missing a semicolon: {$value = $e.value} In the 'atom' rule, you have an action with a call to toInt32 instead of ToInt32. You should add a cast to ArrayList in your action in the 'elist' rule. I can't reproduce the 'eee'

[il-antlr-interest: 23455] Re: [antlr-interest] Error with C# target (CSharp3)

2009-04-30 Thread Sam Harwell
. The bootstrap files are everything in this folder and its subfolders: http://fisheye2.atlassian.com/browse/antlrcs/bin/Bootstrap Thank you, Sam Harwell -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Behalf Of cr...@palantir.co.za Sent

[il-antlr-interest: 23342] Re: [antlr-interest] case-insensitive parsing

2009-04-23 Thread Sam Harwell
Hi Bob, You should make a filter lexer that parses the doc comments by themselves. In your main lexer, read the entire token as a single comment, then you can later pass the text of those comments to the doxygen tag filter lexer to extract the information from those comments. It works great

[il-antlr-interest: 23351] Re: [antlr-interest] Resetting an AST tree walker

2009-04-23 Thread Sam Harwell
I'm working with much larger input files (a few thousand normal source code files). The significant action performed on a TreeNodeStream is a call to LA(int32). For BufferedTreeNodeStream, this encloses the call to FillBuffer(). The profiler revealed that BufferedTreeNodeStream.LA used

[il-antlr-interest: 23324] Re: [antlr-interest] Relaxed number format lexer problem

2009-04-22 Thread Sam Harwell
problem Sam Harwell wrote: I'm using a heavily relaxed NUMBER token in my lexer so I can provide better error messages. The problem I'm having occurs when input such as 1..2 is reached. The '..' should be an OP_RANGE token, not part of the number. Please check the wiki for things like

[il-antlr-interest: 23249] Re: [antlr-interest] Can I restart lexing from definite position indocument?

2009-04-17 Thread Sam Harwell
Is this part of a syntax highlighter? Either way, you can always take an arbitrary token from your original token stream that falls before the location in the document where a change occurred, and substring your document text at that location. Then create a token stream based on the original

[il-antlr-interest: 23251] Re: [antlr-interest] Can I restart lexing from definite positionindocument?

2009-04-17 Thread Sam Harwell
positionindocument? Sam Harwell schrieb: Is this part of a syntax highlighter? Yes. Either way, you can always take an arbitrary token from your original token stream that falls before the location in the document where a change occurred, and substring your document text at that location

[il-antlr-interest: 23253] Re: [antlr-interest] Can I restart lexing from definitepositionindocument?

2009-04-17 Thread Sam Harwell
problems, I'll just build a line buffer, but don't want to buffer the whole file of course (my lexer will be called externally, so I don't even have full access to the document). Kind regards Peter Sam Harwell schrieb: You should tokenize on a per-line basis. Never allow a token to span

[il-antlr-interest: 23262] Re: [antlr-interest] Unexpected CommonTokenStream.Size() result in CSharp runtime

2009-04-17 Thread Sam Harwell
A few things to note: The new unbuffered token stream class (in for version 3.2 I believe) throws a NotSupportedException if you try to get its size. ITokenStream implements IIntStream, and you can't implement IEnumerableIToken and IEnumerableint on the same object with reliable results. I

[il-antlr-interest: 23184] Re: [antlr-interest] Building syntax highlighters with ANTLR

2009-04-16 Thread Sam Harwell
three, beginning of final line through the closing delimiter of the comment. */ Sam From: Gerald Rosenberg [mailto:ger...@certiv.net] Sent: Thursday, April 16, 2009 12:24 AM To: Sam Harwell; antlr-inter...@antlr.org Subject: RE: [antlr-interest] Building syntax highlighters with ANTLR

[il-antlr-interest: 23169] Re: [antlr-interest] Building syntax highlighters with ANTLR

2009-04-15 Thread Sam Harwell
...@antlr.org] On Behalf Of Sam Harwell Sent: Thursday, April 09, 2009 3:38 AM To: antlr-inter...@antlr.org Subject: [antlr-interest] Building syntax highlighters with ANTLR I've made a few posts about this in the past, and it looks like another one is on the way. I designed a new, much easier

[il-antlr-interest: 23181] Re: [antlr-interest] Building syntax highlighters with ANTLR

2009-04-15 Thread Sam Harwell
char delimiters. At 10:56 AM 4/15/2009, Sam Harwell wrote: The new method uses a very different override of NextToken(). The outer loop is largely a duplication of the functionality of Lexer.NextToken(). I've highlighted the key section that reliably manages the lexer state information (yay

[il-antlr-interest: 23134] Re: [antlr-interest] Predicate hoisting pain

2009-04-13 Thread Sam Harwell
Hoisting is a very difficult problem. Until I finish my new spec for implementing reliable hoisting, I suggest one of the following: High speed solution A, used as appropriate: elementsTrue : objectSetElements | LPAREN! elementSetSpecTrue RPAREN! ; elementsFalse : subtypeElements

[il-antlr-interest: 23138] Re: [antlr-interest] Predicate hoisting pain

2009-04-13 Thread Sam Harwell
, 2009 7:55 AM To: Sam Harwell Cc: ANTLR Interest Mailing List Subject: Re: [antlr-interest] Predicate hoisting pain Sam Barnett-Cormack wrote: I guess the question really is, for me, why does it get hoisted in one case and not another? I'm assuming it's because of the choice

[il-antlr-interest: 23147] Re: [antlr-interest] AntLR C# target exceptions problem

2009-04-13 Thread Sam Harwell
The error handling mechanisms are fairly complicated, but adding your own handlers is easy. Just call the base versions after you do what you want: public override void ReportError( RecognitionException e ) { // do something, the StackTrace for e will tell you where the error occurred

[il-antlr-interest: 23150] Re: [antlr-interest] AntLR C# target exceptions problem

2009-04-13 Thread Sam Harwell
I make my IntelliSense parser stop after N exceptions (default 20) via an OperationCanceledException to prevent major performance problems with very large files in the IDE, since the file is often syntactically incorrect while it is being edited and it's reparsed often. Sam From:

[il-antlr-interest: 23108] Re: [antlr-interest] Stupid languages, and parsing them

2009-04-11 Thread Sam Harwell
Here's one way you can handle the keyword scoping problems straight from the parser: In your parser, you instead of referencing IDENTIFIER, create two rules like this: identifier : IDENTIFIER; withSyntaxIdentifier : IDENTIFIER | KEYWORD1 | KEYWORD2 ; And reference these two as appropriate from

[il-antlr-interest: 23091] Re: [antlr-interest] How can I find the line number and column for asemantic error

2009-04-10 Thread Sam Harwell
( message, line, col, length, severity, canCancel ); } public void AddWarning( string message, CommonTree tree ) { AddError( message, tree, Severity.Warning ); } public void AddWarning( string message, CommonToken token ) { AddError( message, token, Severity.Warning ); } Sam

[il-antlr-interest: 23098] Re: [antlr-interest] How can I find the line number and column for asemantic error

2009-04-10 Thread Sam Harwell
$a.tree or $a.token are possibilities. :) Sam From: dhjdhj [mailto:dhj...@gmail.com] Sent: Friday, April 10, 2009 2:24 PM To: Sam Harwell Cc: antlr-inter...@antlr.org Subject: Re: [antlr-interest] How can I find the line number and column for asemantic error Capturing errors

[il-antlr-interest: 23059] [antlr-interest] Building syntax highlighters with ANTLR

2009-04-09 Thread Sam Harwell
I've made a few posts about this in the past, and it looks like another one is on the way. I designed a new, much easier, robust, and general way to make a syntax highlighter from a grammar, and it even allows clean stacking of lexers. As a quick example, my primary grammar recognizes a block

[il-antlr-interest: 23039] Re: [antlr-interest] tree construction that cannot be done with rewriterule

2009-04-07 Thread Sam Harwell
This is probably not perfect (haven't run it) but it should get you close at the least. Based on the CSharp2 target. @parser::members { CommonTree BuildProxyOptionTree( SortedListint,ListCommonTree options ) { object root = adaptor.Nil();

[il-antlr-interest: 23008] Re: [antlr-interest] parsing ugly grammars

2009-04-04 Thread Sam Harwell
There’s a big problem. You can parse this using a synpred, but it will have O(n²) complexity in the length of your input. Is there another possible terminator for the raw data? Newline maybe? With newline terminating the raw data, you’d still have O(n²) complexity in the length of the line. You

[il-antlr-interest: 22873] Re: [antlr-interest] Generic parser class

2009-03-31 Thread Sam Harwell
...@deinprogramm.de] Sent: Tuesday, March 31, 2009 11:58 AM To: Sam Harwell Cc: antlr-inter...@antlr.org Subject: Re: [antlr-interest] Generic parser class Sam Harwell sharw...@pixelminegames.com writes: It doesn't currently support that. However, I've spent a fair bit of time looking

[il-antlr-interest: 22878] Re: [antlr-interest] Failure on OpenJDK on Debian

2009-03-31 Thread Sam Harwell
Also, -Xconversiontimeout 0 disables the timer if that's the condition you're testing. Sam -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Terence Parr Sent: Tuesday, March 31, 2009 1:05 PM To: Ola Bini Cc:

[il-antlr-interest: 22733] Re: [antlr-interest] Maximum method length in generated parser/lexer

2009-03-25 Thread Sam Harwell
Do you know which method is too long? I have a few ideas but it'd narrow down my thinking about it if I knew that. Sam From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Miguel Marques Sent: Wednesday, March 25, 2009 6:39 AM To:

[il-antlr-interest: 22751] Re: [antlr-interest] grammar checking/compilation fails on Windows butnot on Linux

2009-03-25 Thread Sam Harwell
Change your postfixExpression to this: postfixExpression : leftHandSideExpression (('++'|'--') = ( '++' | '--' )?) ; Sam From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Filipe David Manana Sent: Wednesday, March 25, 2009

[il-antlr-interest: 22666] Re: [antlr-interest] Documenting grammars

2009-03-23 Thread Sam Harwell
linked to full-size versions. Sam (Harwell) -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Sam Barnett-Cormack Sent: Monday, March 23, 2009 11:04 AM To: Jim Idle Cc: ANTLR Interest Mailing List Subject: Re: [antlr-interest

[il-antlr-interest: 22669] Re: [antlr-interest] Using extra channels

2009-03-23 Thread Sam Harwell
Yes, you can. If you want to work with those tokens, just pass your channel number to the CommonTokenStream constructor. Sam -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Sam Barnett-Cormack Sent: Monday, March 23, 2009

[il-antlr-interest: 22679] Re: [antlr-interest] CommonTreeNodeStream.size() get streams are ofunknown size exception

2009-03-23 Thread Sam Harwell
You need to switch to use the new BufferedTreeNodeStream class instead. The new CommonTreeNodeStream is unbuffered, so it can't know the size. Sam -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Shaoting Cai Sent: Monday,

[il-antlr-interest: 22611] Re: [antlr-interest] proposal: make .* and .+ always nongreedy

2009-03-21 Thread Sam Harwell
Absolutely (as in I like the idea, no objection). You can always add .* (nothing) or .* EOF if you want to match to the end. Clearly someone who writes .* (anything not EOF) is not trying to read to the end. :) The following is not greedy/works great already: ML_COMMENT : '/*' .*

[il-antlr-interest: 22615] [antlr-interest] Proposal: synpred inversion?

2009-03-21 Thread Sam Harwell
Currently you can only invert sets in a synpred. It seems like inverting the entire predicate could be useful. It could be implemented by backtracking returning state.failed instead of !state.failed, though putting it in the dfa could be a bit tougher (but doable). I'm particularly interested

[il-antlr-interest: 22618] Re: [antlr-interest] Proposal: synpred inversion?

2009-03-21 Thread Sam Harwell
I'm having trouble remembering the case where this came up in the (distant?) past. I'm thinking the non-greedy wildcard might actually resolve the issue. -Original Message- From: Terence Parr [mailto:pa...@cs.usfca.edu] Sent: Saturday, March 21, 2009 2:26 PM To: Sam Harwell Cc: ANTLR

[il-antlr-interest: 22573] Re: [antlr-interest] C# runtime for ANTLR 3.1.3

2009-03-20 Thread Sam Harwell
You should compile the CSharp runtime in Visual Studio 2005 or 2008. That's the one used by the CSharp2 target. The target refers to what you put in the grammar's options section - if you use CSharp2 then the generated code will make use of some C# 2.0 features, but extends the same runtime

[il-antlr-interest: 22579] Re: [antlr-interest] Case insensitive reserved words.

2009-03-20 Thread Sam Harwell
Performance will suffer in a big way. Use a class like the following for your input. Sam public class CaseInsensitiveString : ANTLRStringStream { // the string used for lookahead (performance improvement by not having to call char.ToLowerInvariant()) string _lastring;

[il-antlr-interest: 22540] Re: [antlr-interest] V3 Rule Action allowing inline tree building?

2009-03-18 Thread Sam Harwell
Once you get the hang of it, you can do it by hand without too much trouble. For example, in converting a v2 grammar to v3, I encountered this in the members section: stringAlias = #(#[BLOCK], #(#[ALT], #[STRING_LITERAL], #[EOA]), #[EOB]); Which became this (you can use CommonTree

[il-antlr-interest: 22371] Re: [antlr-interest] Early exit exception in positive closures

2009-03-10 Thread Sam Harwell
When at all possible, avoid using semantic predicates, as they will greatly slow down your grammar relative to a properly left-factored grammar. If the negated set works, it is probably your best option for now. Maybe I can add a subtract set operation you can test, although I couldn't check it

[il-antlr-interest: 22322] Re: [antlr-interest] supress ANTLR comments in the Generated Lexerand Parser code

2009-03-07 Thread Sam Harwell
Invoke the ANTLR Tool from the working directory containing your grammar, and pass the filename without the path. The name and path that show in the generated code are the same as what was passed on the command line. Sam From: antlr-interest-boun...@antlr.org

[il-antlr-interest: 22250] Re: [antlr-interest] Seperating grammar and actions

2009-03-04 Thread Sam Harwell
You have a few options: 1. Only build an AST in the parser, then use a tree walker to perform your needed operations. This is the v3 way to do it, especially with the new filter-mode tree parsers on the way. 2. Call virtual functions from your actions, and implement those

[il-antlr-interest: 21964] Re: [antlr-interest] Editor using ANTLR-Parser

2009-02-17 Thread Sam Harwell
Yep, this is exactly what I use ANTLR for. If you choose to use Visual Studio as your framework IDE, then feel free to ask specific questions here or on the Visual Studio Extensibility (VSX) forum. If you ask ANTLR-related questions over at VSX, you can drop me an email separately to let me

[il-antlr-interest: 21972] Re: [antlr-interest] Editor using ANTLR-Parser #2

2009-02-17 Thread Sam Harwell
Visual Studio Shell 2008 is free for commercial use. That's what we use. Sam -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Ralf Düsedau Sent: Tuesday, February 17, 2009 8:49 AM To: antlr-inter...@antlr.org Subject:

[il-antlr-interest: 21869] Re: [antlr-interest] Lexer issues when block ends with EOF instead ofEOL

2009-02-11 Thread Sam Harwell
This works because lexer tokens are greedy: LINE_COMMENT : '//' (~('\n'|'\r'))* '\r'? '\n'? { $channel=HIDDEN; } ; Sam From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Brent Yates Sent: Wednesday,

[il-antlr-interest: 21737] Re: [antlr-interest] Q: opinions on ikvm + antlr3 ?

2009-02-06 Thread Sam Harwell
from get/set functions to properties, and making function names start with a capital letter. I'll try and get a new set of binaries and an updated version of nFringe's ANTLR language module posted next week. I've made a few tweaks to the Visual Studio support since the last post. Thanks, Sam

[il-antlr-interest: 21748] Re: [antlr-interest] Changing the base node type

2009-02-06 Thread Sam Harwell
You'll also see to call setTreeAdaptor (java target) in the @init section of the entry rule(s) to your grammar. Your implementation of TreeAdaptor should include implementations of at least the following 2 functions (example here is the C# target just because I had it ): class

[il-antlr-interest: 21757] Re: [antlr-interest] Composing tree grammars

2009-02-06 Thread Sam Harwell
Hi Andreas, Make the actions in your tree grammar call virtual/abstract functions. Then derive a new all-code class from the tree grammar class that overrides those functions to provide the action implementation. The ANTLR Tool itself uses this pattern in the AssignTokenTypesWalker tree

[il-antlr-interest: 21695] Re: [antlr-interest] Lexer/parser grammer for Antlrv2

2009-02-04 Thread Sam Harwell
PS: Sorry about the duplicated mail. When I cc'd the author it bounced, so I have to send it here again for him to see it. Are you trying to write a grammar that is build by/targets ANTLR v2 runtime, or are you trying to write a grammar that can parse ANTLR v2 grammar files themselves? I

[il-antlr-interest: 21653] Re: [antlr-interest] ANTLR for syntax highlighting and word completion

2009-02-01 Thread Sam Harwell
I have many posts on my blog about this subject. Here's the link to my blog, and a link to the first major post specific to using ANTLR in an IDE. The ANTLR-based highlighters we're using are nowhere near as slow as Eclipse. However, there are many places where IDE performance imposed

[il-antlr-interest: 21654] Re: [antlr-interest] adding version option to ANTLR grammars

2009-02-01 Thread Sam Harwell
(I'm only offering an independent opinion on this - definitely not trying to insult anyone.) This option feels gimmicky to me. It doesn't address the asynchronous nature of core/target updates, target-to-target incompatibilities, and doesn't identify breaking changes in the Tool between

[il-antlr-interest: 21451] Re: [antlr-interest] Avoiding ClassCastExceptions inorg.antlr.runtime.tree.BaseTree (Limitation in ANTLR v 3.1)

2009-01-20 Thread Sam Harwell
I already fixed some of these in the C# port. Some other ones are: BaseTree.sanityCheckParentAndChildIndexes: this could almost be a static utility method. It doesn't rely on any special features of BaseTree, but it's not part of the Tree interface. BaseTree.replaceChildren: assumes t is a

[il-antlr-interest: 21457] Re: [antlr-interest] ANTLR v3.1.1 released

2009-01-20 Thread Sam Harwell
I've mentioned this behavior several times before. Currently, despite the error, the Tool does behave in the way it states (it references the enclosing rule). I assure you there is no syntactic or semantic ambiguity in this use case under the documented rules of an ANTLR grammar's rewrite syntax.

[il-antlr-interest: 21390] Re: [antlr-interest] ANTLR build step problem (using MS Visual Studio2008, C#)

2009-01-18 Thread Sam Harwell
Add the following in your .csproj: PropertyGroup UseHostCompilerIfAvailableFalse/UseHostCompilerIfAvailable /PropertyGroup Sam From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Ed Key Sent: Sunday, January 18, 2009 9:58 AM To:

[il-antlr-interest: 21312] [antlr-interest] RE: ANTLR performance

2009-01-15 Thread Sam Harwell
Hi Jan, Thanks for taking the time to write up this information. I've actually been curious about these results for a while. :) One thing to bear in mind: the design of the ANTLR grammar you used makes all the difference in the world. ANTLR doesn't do things like cross-rule left factoring

[il-antlr-interest: 21297] Re: [antlr-interest] Passing user defined exceptions through the parser.

2009-01-14 Thread Sam Harwell
: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Peter C. Chapin Sent: Wednesday, January 14, 2009 6:32 AM Cc: antlr-interest Subject: Re: [antlr-interest] Passing user defined exceptions throughtheparser. Sam Harwell wrote: I just checked and the feature

[il-antlr-interest: 21256] Re: [antlr-interest] Passing user defined exceptions through the parser.

2009-01-13 Thread Sam Harwell
There is a throwsSpec in the ANTLR tool grammar that *should* be able to be used like this: my_rule /*returns [Object o]*/ throws RecognitionException, OperationCanceledException : ... ; It doesn't apply to C# so it's not implemented in my CSharp3 target. Sam -Original Message-

[il-antlr-interest: 21259] Re: [antlr-interest] Passing user defined exceptions through theparser.

2009-01-13 Thread Sam Harwell
...@antlr.org] On Behalf Of Sam Harwell Sent: Tuesday, January 13, 2009 10:06 AM To: Peter C. Chapin Cc: antlr-interest Subject: Re: [antlr-interest] Passing user defined exceptions through theparser. There is a throwsSpec in the ANTLR tool grammar that *should* be able to be used like this: my_rule

[il-antlr-interest: 21225] Re: [antlr-interest] Passing user defined exceptions through the parser.

2009-01-11 Thread Sam Harwell
Here's what I do. This is with the C# target so there are probably a few differences, but you'll get the idea. try { MyLexer lexer = new MyLexer( new ANTLRStringStream( text ) ); CommonTokenStream tokens = new CommonTokenStream( lexer ); MyParser parser = new MyParser( tokens );

[il-antlr-interest: 20994] Re: [antlr-interest] Greedy Token Matching?

2008-12-17 Thread Sam Harwell
Add a synpred to the ISODateTime rule: ISODateTime: (ISODate ('T' ISOTime ('Z' | (TZO) = TZO)?)?); The lexer hits the range dash and eats it, entering the TZO fragment. I'm not sure whether or not this is the intended behavior since if TZO and DASH were top-level lexer rules, it would

[il-antlr-interest: 20813] Re: [antlr-interest] lexing nested comments

2008-12-03 Thread Sam Harwell
MULTI_COMMENT : '/*' { $channel=HIDDEN; } ( ~('/'|'*') | ('/' ~'*') = '/' | ('*' ~'/') = '*' | MULTI_COMMENT

[il-antlr-interest: 20696] Re: [antlr-interest] wildcard in tree grammar

2008-11-28 Thread Sam Harwell
: ^(. {System.out.println(tree node);} tree*) Sam -Original Message- From: Oliver Zeigermann [mailto:[EMAIL PROTECTED] Sent: Thursday, November 27, 2008 2:24 AM To: Gavin Lambert Cc: Terence Parr; Sam Harwell; antlr-interest Interest Subject: Re: [antlr-interest] wildcard in tree grammar 2008/11/27 Gavin

[il-antlr-interest: 20689] Re: [antlr-interest] wildcard in tree grammar

2008-11-26 Thread Sam Harwell
It does make sense to have the following action: . as the first child of a multi-child block matches any single node . in any other position matches any node or subtree The following modified check in TreeToNFAConverter should correct the issues people are seeing. Remember I'm using V3 grammars

[il-antlr-interest: 20638] Re: [antlr-interest] Antlr v2 AST - v3 AST

2008-11-24 Thread Sam Harwell
That's almost correct. The direct translation would be this: logical_literal : 'false' - LOGICAL_LITERAL[] ; However, many v2 AST construction rules follow this pattern with a setLine/setColumn pair, in which case, the following would be better. There are other advantages to this method as

[il-antlr-interest: 20558] Re: [antlr-interest] possible bug?

2008-11-18 Thread Sam Harwell
You might try the following: fragment IP : ; fragment IPNET : ; NUMBER : NumberFormat ( POINT NumberFormat POINT NumberFormat POINT NumberFormat {$type = IP;} ( SLASH NumberFormat {$type = IPNET;} )? )? ; NumberFormat : '0' | '1'..'9' DIGIT* ; Then validate a

[il-antlr-interest: 20527] Re: [antlr-interest] Number tokenizer vs. number grammar

2008-11-15 Thread Sam Harwell
The problem you'll encounter is order of operations. If the following is valid in your language: 2 * 3+2i Then is the result supposed to be 6+2i or 6+4i? What about 2*3+2i? How the language treats order of operations will determine your possible approaches. Sam -Original Message-

[il-antlr-interest: 20521] Re: [antlr-interest] Extracting autocompletion rules from antlr grammar

2008-11-14 Thread Sam Harwell
ANTLR itself is not the correct method for implementing autocompletion features. Our IntelliSense engine (our support for Visual Studio's autocompletion code navigation features) does involve ANTLR, but maybe not in the way you expect. Autocomplete is not a syntactical analysis process; it is a

[il-antlr-interest: 20487] Re: [antlr-interest] Simple grammar doesn't complain about illegal input

2008-11-13 Thread Sam Harwell
Your grammar actually just stopped parsing at addj. You need to add an EOF to the end of the prog rule to make sure it prints an error rather than stops processing the file: prog: (add NEWLINE)+ EOF ; Sam -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of

[il-antlr-interest: 20490] Re: [antlr-interest] Simple grammar doesn't complain about illegal input

2008-11-13 Thread Sam Harwell
? I wonder. Thanks in advance. El jue, 13-11-2008 a las 12:46 -0600, Sam Harwell escribió: Your grammar actually just stopped parsing at addj. You need to add an EOF to the end of the prog rule to make sure it prints an error rather than stops processing the file: prog: (add NEWLINE)+ EOF

  1   2   >