[il-antlr-interest: 26229] Re: [antlr-interest] Does lexer EVER use longest match?

2009-10-13 Thread J. Stephen Riley Silber
Ter, This is an issue that enough of us run into and eventually figure out how to hack around. I honestly can't remember if it's covered in the First Book, but might this be a candidate for inclusion in a later edition, a kind of anti-pattern to be on the lookout for? _

[il-antlr-interest: 24742] Re: [antlr-interest] Filtering peer nodes in a tree

2009-07-19 Thread J. Stephen Riley Silber
  > I tried using a rule like ^( BLOCK .* ASSIGN ASSIGN .* ), but that didn't > seem to work. I've recently discovered that .* on the end doesn't seem to work too well. I think I tried .+ or was it .* followed by UP...no, i think it was ~UP*. I need to fix this. Ter I just tried all of those, t

[il-antlr-interest: 24740] [antlr-interest] Filtering peer nodes in a tree

2009-07-18 Thread J. Stephen Riley Silber
Hi gang, I'm having a bit of trouble with a tree filter.  I'm trying to take ASSIGN trees like this: ^( ASSIGN ID expr ) and merge them together whenever they are adjacent to each other in a tree under a BLOCK node.  So, bigger example: ^( BLOCK     ^( foo ... )     ^( ASSIGN ID expr )     ^(

[il-antlr-interest: 24675] [antlr-interest] Printing weirdness in tree filters

2009-07-15 Thread J. Stephen Riley Silber
Howdy, Is there any reason that the default downup() prints out all the transformations it makes?  Is this perhaps something that will be turned into an option in 3.2?  (The default implementation is more than adequate, except for that little detail.) --S --~--~-~--~~~

[il-antlr-interest: 24657] Re: [antlr-interest] Parsing HAML - significant and insignificant whitespaces

2009-07-15 Thread J. Stephen Riley Silber
Hi, In cases like this, I prefer not to jump through the parsing hoops that Python-style whitespace requires.  Instead, I write a preprocessor (in Perl, usually) that adds extra tokens to the source file, making the whitespace irrelevant again. To modify your example, I would take %A     %B  

[il-antlr-interest: 24626] Re: [antlr-interest] two part operators

2009-07-13 Thread J. Stephen Riley Silber
I might not be understanding how you want them both to be binary operators.  But what if you have two different tokens for each operator, eg. 'X' and 'X NOT', and treat them as different operators? --- On Mon, 7/13/09, Jennifer Cooper wrote: From: Jennifer Cooper Subject: [antlr-interest] two

[il-antlr-interest: 24541] [antlr-interest] ANTLRWorks question

2009-07-07 Thread J. Stephen Riley Silber
Hi gang, (BTW, is there a different mailing list for ANTLRWorks questions?) If not, I'm having a bit of trouble with breakpoint debugging.  I saw an item in a version's release notes saying that you could set a breakpoint on the input text or in the grammar.  I figured out how to do the input t

[il-antlr-interest: 24538] Re: [antlr-interest] Collecting disparate subtrees into one tree?

2009-07-07 Thread J. Stephen Riley Silber
And if it doesn't, you can try the more explicit variant: code : (p+=proc | f+=func)*   -> ^(CODE ^(PROCS $p*) ^(FUNCS $f*))   ; (Or leave out the PROCS/FUNCS nodes if you just want to reorder the procedures/functions without actually grouping them in a subtree.) The Real World interfered for a

[il-antlr-interest: 24465] Re: [antlr-interest] Collecting disparate subtrees into one tree?

2009-07-01 Thread J. Stephen Riley Silber
Hi Damien, > doesn't something like this work? > > code: procs* funcs* >   -> ^(CODE ^(PROCS procs*) ^(FUNCS funcs*)) > I don't think it would, because it still requires that procs be grouped together in the source code, as well as funcs. Something like code: (proc | func)* would be

[il-antlr-interest: 24454] [antlr-interest] Collecting disparate subtrees into one tree?

2009-06-30 Thread J. Stephen Riley Silber
Hi gang, Here's a question for you.  (Apologies if this is explained somewhere; I haven't found it yet.)  Suppose I have a language where I have procedures and functions (Oh! Pascal!), such as this:     procedure a() { ... }     function x() { ... }     procedure b() { ... }     function y() {

[il-antlr-interest: 24342] Re: [antlr-interest] ok, will build an LLVM example for book

2009-06-24 Thread J. Stephen Riley Silber
I think Waverly's point wasn't the complexity of the grammar of the language.  No one is arguing the simplicity of the Smalltalk grammar.  His point was that compiling a simple imperative language to LLVM will demonstrate the basics of LLVM IL generation.  "Everyone knows C", so it should make

[il-antlr-interest: 24174] Re: [antlr-interest] Tree grammar example, redux

2009-06-11 Thread J. Stephen Riley Silber
Finally got around to trying this and it worked like a champ.  Thanks, Ter. --- On Tue, 6/2/09, Terence Parr wrote: From: Terence Parr Subject: Re: [antlr-interest] Tree grammar example, redux To: "J. Stephen Riley Silber" Cc: antlr-inter...@antlr.org Date: Tuesday, June 2, 2009, 4:

[il-antlr-interest: 24090] Re: [antlr-interest] Customizing token separators without recompiling

2009-06-07 Thread J. Stephen Riley Silber
Oh, I'm saying you wouldn't want to use a grammar at all.  The problem you've described is lexical, not grammatical.  If you simply want to break apart a line of text based on an arbitrary delimiter, it would be much easier to write a program in Perl, Python, Java, etc. that split the text based

[il-antlr-interest: 24088] Re: [antlr-interest] Customizing token separators without recompiling

2009-06-07 Thread J. Stephen Riley Silber
Howdy, I'm guessing there's more to the problem than just supporting arbitrary field separation tokens, because if that's all there is, just use something like perl and store the separator(s) in a config file...? --S --- On Sun, 6/7/09, Dukie Banderjee wrote: From: Dukie Banderjee Subject:

[il-antlr-interest: 24075] Re: [antlr-interest] "Language design patterns" book available in beta

2009-06-05 Thread J. Stephen Riley Silber
Indeed!  But then, *we* don't want to limit you to 350 pages, either!  :-) --- On Fri, 6/5/09, Terence Parr wrote: From: Terence Parr Subject: Re: [antlr-interest] "Language design patterns" book available in beta To: "Edwards, Waverly" Cc: "antlr ANTLR" Date: Friday, June 5, 2009, 4:15 PM H

[il-antlr-interest: 24063] Re: [antlr-interest] "Language design patterns" book available in beta

2009-06-05 Thread J. Stephen Riley Silber
No brainer.  Be terse with the example code, but have it all downloadable online.  Please do NOT skimp on the pattern explanations!  That's where this book is strongest. For example, the top-down and bottom-up tree rewriting stuff on antlr.org?  I really didn't understand why some things should

[il-antlr-interest: 24062] Re: [antlr-interest] Thanks

2009-06-05 Thread J. Stephen Riley Silber
Wow, Christian, tell me how you convinced your company to let you do this.  I tried to get a company to use a DSL to make their custom app development about 50 times more efficient, but to no avail.  They literally thought things like "inventing a human-usable language" was impossible, and inste

[il-antlr-interest: 24046] Re: [antlr-interest] "Language design patterns" book available in beta

2009-06-04 Thread J. Stephen Riley Silber
Parr Subject: Re: [antlr-interest] "Language design patterns" book available in beta To: "J. Stephen Riley Silber" Cc: "String Template Mailing LIst" , "antlr ANTLR" Date: Thursday, June 4, 2009, 1:09 PM I do actually have a write up from a prototype of the

[il-antlr-interest: 24043] Re: [antlr-interest] "Language design patterns" book available in beta

2009-06-04 Thread J. Stephen Riley Silber
May I request less "hoping" and more "doing"?  Because llvm stuff would be AWESOME.  An approachable example would be so very Rosetta Stone-ish. --- On Thu, 6/4/09, Terence Parr wrote: From: Terence Parr Subject: Re: [antlr-interest] "Language design patterns" book available in beta To: "ugol

[il-antlr-interest: 24007] Re: [antlr-interest] "Language design patterns" book available in beta

2009-06-03 Thread J. Stephen Riley Silber
Whoo!  I just downloaded my beta!  (Don't spend all that royalty money in one place!)  I'm very excited about this book.  Congratulations, Ter, and thanks! --S --- On Wed, 6/3/09, Terence Parr wrote: From: Terence Parr Subject: [antlr-interest] "Language design patterns" book available in bet

[il-antlr-interest: 23982] [antlr-interest] Tree grammar example, redux

2009-06-02 Thread J. Stephen Riley Silber
Hi gang, Frank mentioned the second example in this article (http://www.antlr.org/wiki/display/ANTLR3/Simple+tree-based+interpeter) not working as of 3.1.3.  I, too, have been trying to get it working, to no avail. Did something fundamental change in the TreeNodeStream functionality?  I like t

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

2009-06-02 Thread J. Stephen Riley Silber
Oh, Ian, you have to be careful with posts like that.  Terence is very sneaky like that.  :-) --- On Tue, 6/2/09, Terence Parr wrote: From: Terence Parr Subject: Re: [antlr-interest] ocaml target? To: "Ian Eyberg" Cc: antlr-inter...@antlr.org Date: Tuesday, June 2, 2009, 12:31 PM On Jun 2,