[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 (som

[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
though [...] 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.ant

[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 te

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

2009-11-02 Thread Sam Harwell
/downloads/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

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

2009-11-02 Thread Sam Harwell
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 Harwell --~--~-~--~~

[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
r projects. 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

[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
that out too, but it should be straightforward. Sam From: Jim Idle [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#

[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
ource, 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

[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 versi

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

2009-10-18 Thread Sam Harwell
directly. -Original 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

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

2009-10-08 Thread Sam Harwell
- From: 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

[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 p

[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 configu

[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 back

[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 t

[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 gramma

[il-antlr-interest: 25008] Re: [antlr-interest] How to extend the CommonTree without getting aclasscastexcpetion in the generated code?

2009-08-03 Thread Sam Harwell
1. Derive a class CustomizedErrorNode from your class CustomizedNode. 2. Derive a class CustomizedTreeAdaptor from CommonTreeAdaptor. In it, override create(Token) to return a CustomizedNode, and override errorNode(TokenStream,Token,Token,RecognitionException) to return a CustomizedErrorNode. Se

[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 cod

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

2009-07-21 Thread Sam Harwell
arget) 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

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

2009-06-28 Thread Sam Harwell
@antlr.org] 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

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

2009-06-27 Thread Sam Harwell
re Java. If you really are trying to let end-users compile grammars, 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

[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 ma

[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 u

[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 [mailto:antlr-interest-boun...@antlr

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

2009-05-22 Thread Sam Harwell
ually lighter than 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-...@ant

[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 st

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

2009-05-20 Thread Sam Harwell
o:j...@temporal-wave.com] 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

[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: Wednesday

[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: antlr-in

[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# targe

[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: antlr-interest-boun...@an

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

2009-05-07 Thread Sam Harwell
eems like a good way to go. I'll look into Android. I'm curious now. Its challenging for me to understand how the folks at Google could make a loser (big mistakes) like the one you refer to after having so many winners. W. From: antlr-i

[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 i

[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 [mailto:antlr-

[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: 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' error

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

2009-04-30 Thread Sam Harwell
ntime. 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.

[il-antlr-interest: 23375] Re: [antlr-interest] action execution at the rule prediction stage

2009-04-25 Thread Sam Harwell
Actions surrounded in double angle brackets are "always" run. This means they run during backtracking, but they may or may not run during prediction. If you're not careful, they may have unpredictable results. Here is what they look like: rule : subrule {{AlwaysRunMe();}} ; You also have th

[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 3.10

[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 and

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

2009-04-22 Thread Sam Harwell
t] Relaxed number format lexer 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 numb

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

2009-04-22 Thread Sam Harwell
7;a'..'d' | 'f'..'z' | 'A'..'D' | 'F'..'Z' ) | &

[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 IEnumerable and IEnumerable on the same object with reliable results. I looked to th

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

2009-04-17 Thread Sam Harwell
t result in any 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 b

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

2009-04-17 Thread Sam Harwell
m definite 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 docum

[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 toke

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

2009-04-15 Thread Sam Harwell
or close delimiter * Part 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 highl

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

2009-04-15 Thread Sam Harwell
s. Note, the attached version is set up for just for single 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 k

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

2009-04-15 Thread Sam Harwell
// match() routine has already called recover() } } } From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Sam Harwell Sent: Thursday, April 09, 2009 3:38 AM To: antlr-inter...@antlr.org Subject: [antlr-interest] Building synta

[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: antlr-inte

[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 base.R

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

2009-04-13 Thread Sam Harwell
It's a good idea to override ReportError, and this will almost surely provide you with the results you want. You can also put a breakpoint in NoViableAltException's constructor. Sam -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Be

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

2009-04-13 Thread Sam Harwell
, April 13, 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 be

[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: 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: 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 is not

[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
AddError( message, token, Severity.Warning ); } Sam Harwell -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Behalf Of dhjdhj Sent: Friday, April 10, 2009 11:16 AM To: antlr-inter...@antlr.org Subject: [antlr-interest] How can I find

[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 com

[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( SortedList> options ) { object root = adaptor.Nil(); foreach ( KeyValuePa

[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: 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: antlr-inter...@a

[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" writes: > It doesn't currently support that. However, I've spent a fair bit of > time looking into th

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

2009-03-31 Thread Sam Harwell
It doesn't currently support that. However, I've spent a fair bit of time looking into the possibilities of it. Can you give an idea of specifically what you're trying to accomplish with the generics, and if it falls into one of the areas I've worked on I can give some ideas on how to progress.

[il-antlr-interest: 22808] Re: [antlr-interest] ANTLR 3.1.3 performance issue

2009-03-27 Thread Sam Harwell
Try changing all your usage of CommonTreeNodeStream to BufferedTreeNodeStream, and see if it corrects the issue. Also, do you have any way to check if the time increase was in the lexer, parser, or tree walker? Sam From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@ant

[il-antlr-interest: 22773] Re: [antlr-interest] could not even do k=1 for decision 126; reason: timed out

2009-03-25 Thread Sam Harwell
If you don’t left-factor your rules, it attempts to do so for you. If that process takes longer than the timeout period (default 1 second), it assumes it can’t be done and errors out. Of the two rules below, the former is vastly superior. If you absolutely must use something like the second, at

[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: 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: antlr-inter...@antl

[il-antlr-interest: 22724] Re: [antlr-interest] 3.1.3 only accepts *.g extensions

2009-03-24 Thread Sam Harwell
I use .g3 for all my V3 grammars, including all the ones in the C# port of the Tool, so I already implemented support for multiple extensions. You can use similar code to offer flexibility to the allowed extensions. However, in the particular use in the Tool (filtering after graph sorting), I bel

[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, M

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

2009-03-23 Thread Sam Harwell
: Dennis Brothers Cc: ANTLR Interest Mailing List Subject: Re: [antlr-interest] Documenting grammars Dennis Brothers wrote: > On Mar 23, 2009, at 2:23 PM, Sam Barnett-Cormack wrote: > >> Sam Harwell wrote: >>> Why not create our own format that properly describes grammars? >&g

[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 1

[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: 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

[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 i

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

2009-03-21 Thread Sam Harwell
Just .* EOF Would work too. :) -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Terence Parr Sent: Saturday, March 21, 2009 2:18 PM To: Sam Barnett-Cormack Cc: ANTLR Interest Mailing List Subject: Re: [antlr-interest] proposa

[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: 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; pub

[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 clas

[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 in

[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 [mailto:antlr-interest-boun...@

[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 functio

[il-antlr-interest: 22001] Re: [antlr-interest] Using the python output with ANTLR3

2009-02-19 Thread Sam Harwell
You'll need to convert all actions and semantic predicates to valid python code. These are present in [at least] the following rules: assignmentOperator relationalOp shiftOp ENUM ASSERT Sam -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.

[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: [antl

[il-antlr-interest: 21966] Re: [antlr-interest] How do you build this AST?

2009-02-17 Thread Sam Harwell
If you have the option output=AST specified, then your rewrite rules are the default behavior. Unnecessary rewrites will incur a significant performance penalty since they are not optimized. The penalty is masked if the grammar is not properly left-factored, but it should still be avoided. The

[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 know

[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, Febr

[il-antlr-interest: 21841] Re: [antlr-interest] Access Specifier for lexer's and parsers

2009-02-10 Thread Sam Harwell
/listinfo/antlr-interest > Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address > Currently there is no way to do so. At least with the Java version of the tool. Sam Harwell is working a C# port with some extended features, which allows at least to use access modif

[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 gram

[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 GrammarASTAdapto

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

2009-02-06 Thread Sam Harwell
tinue working. Two examples are the continued move 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 t

[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 ha

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

2009-02-04 Thread Sam Harwell
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 haven't worked with ANTLR v2, but I believe the information you are looking for could be here: http://www.antlr2.org/ Sam

[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 version

[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 "interest

[il-antlr-interest: 21473] Re: [antlr-interest] ANTLR Questions

2009-01-21 Thread Sam Harwell
ASTLabelType only changes what nodes are cast to inside the generated code. For example, if you call a function from an action in your grammar, and pass it a node, it will pass a Tree interface (ITree in the CSharp/CSharp2 runtime) by default: MyFunction( ((Tree)someNode) ); However, if you s

[il-antlr-interest: 21472] Re: [antlr-interest] Highlighting syntax errors

2009-01-21 Thread Sam Harwell
All Visual Studio language service features run on separate threads from the main UI thread. I have several posts on my blog (http://blog.280z28.org/) talking about ANTLR/Visual Studio integration for language services. If you are interested, I could probably add articles on the following: ·

[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.

  1   2   >