[il-antlr-interest: 26535] Re: [antlr-interest] Can somebody give me the very simplest example of grammar to AST to StringTemplate output

2009-10-27 Thread Naveen Chawla
Dear Jim, I like your sense of humour! You'll probably be annoyed that I already took the time read the book before I checked my email for your message because I didn't think anyone would reply. I wasn't asking anybody to read the manual, just if someone knew it off-hand. It would have saved me ti

[il-antlr-interest: 26521] Re: [antlr-interest] Can somebody give me the very simplest example of grammar to AST to StringTemplate output

2009-10-26 Thread Naveen Chawla
7;t find it "bunched together" as such. Many thanks, N 2009/10/26 Naveen Chawla > Sorry if I sound rushed, I'm doing so many other things as well. > > Regards, N > > 2009/10/26 Naveen Chawla > > I can't open the "tpantlr-code" file in that archiv

[il-antlr-interest: 26520] Re: [antlr-interest] Can somebody give me the very simplest example of grammar to AST to StringTemplate output

2009-10-26 Thread Naveen Chawla
Sorry if I sound rushed, I'm doing so many other things as well. Regards, N 2009/10/26 Naveen Chawla > I can't open the "tpantlr-code" file in that archive, for some reason. Can > somebody give me, for example "a: 'hello'; ", just that single symb

[il-antlr-interest: 26519] Re: [antlr-interest] Can somebody give me the very simplest example of grammar to AST to StringTemplate output

2009-10-26 Thread Naveen Chawla
he archive. > > > > The book has a very good explanation too. > > > > Cheers, Indhu > > > > > > *From:* antlr-interest-boun...@antlr.org [mailto: > antlr-interest-boun...@antlr.org] *On Behalf Of *Naveen Chawla > *Sent:* Saturday, October 24, 2009 9:11 AM

[il-antlr-interest: 26479] Re: [antlr-interest] Can somebody give me the very simplest example of grammar to AST to StringTemplate output

2009-10-23 Thread Naveen Chawla
No, where? Many thanks, N 2009/10/23 Terence Parr > have you looked at the (free) code for both books? > Ter --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send ema

[il-antlr-interest: 26463] [antlr-interest] Can somebody give me the very simplest example of grammar to AST to StringTemplate output

2009-10-23 Thread Naveen Chawla
I'd like to use all the features of ANTLR all the way up to StringTemplate etc. for e.g. a translation, can someone give me the very simplest example they possibly can, for a beginner, of a grammar, to an AST (very, very simple) to using StringTemplate and then a translated output (with maybe a "Tr

[il-antlr-interest: /] Re: [antlr-interest] How to make a syntactic predicate exit a rule completely

2009-10-18 Thread Naveen Chawla
by an object (or two) but then followed by a verbPhrase, discount the fact that there may be a complement for that verb, otherwise act normally as though there might". It doesn't handle two *objects* properly but I can easily do that now. My entire English structure grammar is done

[il-antlr-interest: 26369] Re: [antlr-interest] Semantic predicates

2009-10-18 Thread Naveen Chawla
Yes, I alluded to that in another thread, "How to make a syntactic predicate exit a rule completely". I am a beginner in this area, but I think that what you said is true of syntactic predicates as well. I think it would make ANTLR more powerful, if this feature existed (of not matching a rule if a

[il-antlr-interest: 26366] Re: [antlr-interest] How to make a syntactic predicate exit a rule completely

2009-10-18 Thread Naveen Chawla
Afterwards, in the tree walk, determine whether the various > combinations of clauses are correct, issue good errors here if not; > > 3) Generate code (or whatever it is you are doing) in the knowledge > that it is all good from here. > > > > Jim > > >

[il-antlr-interest: 26353] [antlr-interest] How to make a syntactic predicate exit a rule completely

2009-10-17 Thread Naveen Chawla
Ok, so even if all syntactic predicates have failed in a particular rule, that rule is still included as "matched" in that analysis! Is this true or are my tests wrong? This is not what I hoped. I was hoping that upon complete failure of all syntactic predicates in a rule, the rule becomes disregar

[il-antlr-interest: 26310] Re: [antlr-interest] How do I output an alert box or something in the console in ANTLRWorks, in grammar actions?

2009-10-16 Thread Naveen Chawla
Thanks Indhu! This might help me a lot now. 2009/10/16 Indhu Bharathi > Sustem.out.println will print in the output tab. > > > > *From:* antlr-interest-boun...@antlr.org [mailto: > antlr-interest-boun...@antlr.org] *On Behalf Of *Naveen Chawla > *Sent:* Friday, October 1

[il-antlr-interest: 26306] Re: [antlr-interest] How to do "not" in a syntactic predicate?

2009-10-16 Thread Naveen Chawla
ark();} a {bFoundYet=false; i=input.index();} b? {if(input.index()>i){bFoundYet=true;input.rewind(mark);} } {bFoundYet==false}?=> ; //"mark" and "bFound" are my own variables, already declared Obviously something is wrong here and there may be a much, much simpler

[il-antlr-interest: 26305] [antlr-interest] How do I output an alert box or something in the console in ANTLRWorks, in grammar actions?

2009-10-16 Thread Naveen Chawla
System.out.println("a string") doesn't seem to output anything, and Window.alert("a string") doesn't work. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email t

[il-antlr-interest: 26286] Re: [antlr-interest] How to do "not" in a syntactic predicate?

2009-10-15 Thread Naveen Chawla
is only a hack for the specific problem you > posted. Maybe your original problem can be solved in a more elegant way. > Cases that require hacks of this kind are very rare and arises only while > parsing some very obscure languages. > > > > Cheers, Indhu > > > >

[il-antlr-interest: 26262] Re: [antlr-interest] How to do "not" in a syntactic predicate?

2009-10-14 Thread Naveen Chawla
at problem by turning off greedy. Grep for ‘greedy’ in the book or wiki. > > > > Cheers, Indhu > > > > > > *From:* antlr-interest-boun...@antlr.org [mailto: > antlr-interest-boun...@antlr.org] *On Behalf Of *Naveen Chawla > *Sent:* Wednesday, October 14, 2009 3:50

[il-antlr-interest: 26256] Re: [antlr-interest] How to do "not" in a syntactic predicate?

2009-10-14 Thread Naveen Chawla
== A && input.LA(2) != B}?=> > > > > However, if you need that kind of syntactic predicate, then I suggest you > may be approaching your problem incorrectly. > > > > Jim > > > > *From:* antlr-interest-boun...@antlr.org [mailto: > antlr-interest-boun...@a

[il-antlr-interest: 26120] Re: [antlr-interest] Help writing a particular semantic predicate

2009-10-06 Thread Naveen Chawla
Ok, I've solved my particular problem using token lookaheads, but I was wondering if there is a way of doing non-terminal symbol lookaheads in semantic predicates? 2009/10/6 Naveen Chawla > grammar x; > > x: a b; > > a: 'i' a? | c? 'j'; //

[il-antlr-interest: 26117] [antlr-interest] Help writing a particular semantic predicate

2009-10-06 Thread Naveen Chawla
grammar x; x: a b; a: 'i' a? | c? 'j'; // Question, how would I write the semantic predicates: if this "a" is followed by 'v1' choose the first alternative, if not choose the second alternative c: 'i'; b: 'v1' | 'v2'; --~--~-~--~~~---~--~---

[il-antlr-interest: 26093] Re: [antlr-interest] Enforcin g a right associativity, to resolve an ambiguity (simple gram mar included)

2009-10-05 Thread Naveen Chawla
you can safely ignore it". Thanks. 2009/10/3 Naveen Chawla > To be clear, I want prepPhr to always belong to the last occuring 'Ving' > (nounPhrase) before it (i.e. drinking-while-driving) > > 2009/10/2 Naveen Chawla > > Hi, >> >> I'm a little

[il-antlr-interest: 26091] Re: [antlr-interest] A wish

2009-10-05 Thread Naveen Chawla
be marked in red and you can check > the “Syntax diagram” tab to graphically see the ambiguity. > > > > > > *From:* antlr-interest-boun...@antlr.org [mailto: > antlr-interest-boun...@antlr.org] *On Behalf Of *Naveen Chawla > *Sent:* Monday, October 05, 2009 7:44 PM >

[il-antlr-interest: 26088] [antlr-interest] A wish

2009-10-05 Thread Naveen Chawla
I wish "Decision can match input such as ... using multiple alternatives" would show the whole phrase that raises the ambiguity, and not just the token. Is there an easy way to find this out? Would it be easy for it to be introduced into ANTLR, or do I always have to see only the token every time

[il-antlr-interest: 26086] [antlr-interest] How to do "not" in a syntactic predicate?

2009-10-05 Thread Naveen Chawla
If I do (a ~b)=> a meaning "take this alternative if you encounter an a when not followed by b" I get a syntax error: unexpected token b Is it the right syntax to use '~'? N --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

[il-antlr-interest: 26060] Re: [antlr-interest] Enforcin g a right associativity, to resolve an ambiguity (simple gram mar included)

2009-10-03 Thread Naveen Chawla
To be clear, I want prepPhr to always belong to the last occuring 'Ving' (nounPhrase) before it (i.e. drinking-while-driving) 2009/10/2 Naveen Chawla > Hi, > > I'm a little bit stumped. You might find this easy. I'm trying to develop > an English parser and have

[il-antlr-interest: 26057] [antlr-interest] Enforcing a right associativity, to resolve an ambiguity (simple grammar included)

2009-10-02 Thread Naveen Chawla
Hi, I'm a little bit stumped. You might find this easy. I'm trying to develop an English parser and have come across a real ambiguity in English, on which, for the time being, I just want to enforce simple right associativity: e.g. Recommending drinking while driving is dangerous. (Is it referri

[il-antlr-interest: 26043] Re: [antlr-interest] Left factor? Syntactic predicates? Or another solution?

2009-10-01 Thread Naveen Chawla
Thanks! 2009/10/1 Gavin Lambert > At 01:24 2/10/2009, Naveen Chawla wrote: > >> Thanks so much! Yes, I tried complement: object object? coincidentally >> just before I read your message and it worked. Good news is that in the real >> grammar they ARE actually equivalent

[il-antlr-interest: 26033] Re: [antlr-interest] Left factor? Syntactic predicates? Or another solution?

2009-10-01 Thread Naveen Chawla
o work on ANTLRWorks) Many many thanks, N 2009/10/1 Gavin Lambert > At 23:13 1/10/2009, Naveen Chawla wrote: > >> complement: indirectObject? object; >> >> indirectObject : nounPhrase; >> >> object : nounPhrase; >> >>

[il-antlr-interest: 26031] [antlr-interest] Left factor? Syntactic predicates? Or another solution?

2009-10-01 Thread Naveen Chawla
I am trying to write an English grammar with ANTLR and have simplified a particular problem to a particular subset for your convenience. (I'm using ANTLRWorks 1.3) grammar predicate; predicate : 'verb' complement?; complement: indirectObject? object; indirectObject : nou