[antlr-interest] Re: Problem converting grammar into java files(How to proceed further)
bhuvana_t_76
bhuvana_t_76 at yahoo.com
Sun Jul 11 22:55:23 PDT 2004
hi,
After compiling the SqlSQL2.g into java files, i compiled them into
creating .class files. I want to make use of those class files in my
application. I gave a sample code like this:
import java.io.*;
class Test {
public static void main(String[] args) {
try {
SqlSQL2Lexer lexer = new SqlSQL2Lexer(new DataInputStream
(System.in));
System.out.println("lexer "+lexer);
SqlSQL2Parser parser = new SqlSQL2Parser(lexer);
System.out.println("parser "+parser);
} catch(Exception e) {
System.err.println("exception: "+e);
}
}
}
How to proceed further? ie, which method of 'SqlSQL2Parser.java', I
have to use for checking a sql query's validity. Can u guide me?
thanks.
bhuvana.
--- In antlr-interest at yahoogroups.com, "bhuvana_t_76"
<bhuvana_t_76 at y...> wrote:
> hi Ric & Monty,
>
> Thanks for ur help. Succeeded in compiling the grammar .g file into
> java files after reading the documentation for inheriting the
> supergrammars.
>
> In the command prompt, i gave like this:
>
> java antlr.Tool -glib DmlSQL2.g SqlSQL2.g
>
> Thanks again.
>
> bhuvana.
> --- In antlr-interest at yahoogroups.com, Monty Zukowski <monty at c...>
> wrote:
> > You have to specify the supergrammar on the command line, see the
> > options for antlr.Tool. That's what Ric meant when he said:
> >
> > > Check out the grammar inheritance section of the manual for the
> > > mechanisms behind it.
> >
> > Monty
> >
> >
> > ANTLR & Java Consultant -- http://www.codetransform.com
> > ANSI C/GCC transformation toolkit --
> > http://www.codetransform.com/gcc.html
> > Embrace the Decay --
http://www.codetransform.com/EmbraceDecay.html
> >
> > On Jul 9, 2004, at 5:52 AM, bhuvana_t_76 wrote:
> >
> > > succeeded in converting Dml2SQL grammar to java. But still the
> same
> > > error for SqlSQL2 as the given one:
> > >
> > > error: grammar DmlSQL2Parser not defined
> > > error: grammar DmlSQL2Lexer not defined
> > >
> > > I tried compiling java files to .class files. Still the same
> error.
> > > Can anyone guide me whether SqlSQL2 will work or not. Thanks.
> > >
> > > bhuvana.
> > >
> > > --- In antlr-interest at yahoogroups.com, "bhuvana_t_76"
> > > <bhuvana_t_76 at y...> wrote:
> > >> i tried with changing 'cpp' into 'java'. Still it generates cpp
> > >> files. Can u pls tell me how I can convert it into java. Very
> > > urgent.
> > >>
> > >> Thanks in adv.
> > >>
> > >> bhuvana.
> > >>
> > >> --- In antlr-interest at yahoogroups.com, Ric Klaren <klaren at c...>
> > > wrote:
> > >>> On Fri, Jul 09, 2004 at 11:56:52AM -0000, bhuvana_t_76 wrote:
> > >>>> Right. There is a DmlSQL2 package available for download. I
> > > tried
> > >> to
> > >>>> convert it from grammar to java file. When i give like
> > >>>>
> > >>>> java antlr.Tool DmlSQL2.g
> > >>>>
> > >>>> it creates .cpp files. How to get the java stuff from a
> > > grammar.
> > >> Can
> > >>>> u guide me?
> > >>>
> > >>> Remove the Language = "Cpp"; option but there's probably also
> > > other
> > >> action
> > >>> code you have to port to java.
> > >>>
> > >>> Cheers,
> > >>>
> > >>> Ric
> > >>> --
> > >>> -----
> > >>
> +++++*****************************************************+++++++++-
> > > --
> > >> ----
> > >>> ---- Ric Klaren ----- j.klaren at u... ----- +31 53
4893755 --
> --
> > >>> -----
> > >>
> +++++*****************************************************+++++++++-
> > > --
> > >> ----
> > >>> Quidquid latine dictum sit, altum viditur.
> > >>> (Whatever is said in Latin sounds profound.)
> > >
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list