grammatica-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: [Grammatica-users] How can I generate grammar at run-time?


From: Ламер
Subject: Re: Re: [Grammatica-users] How can I generate grammar at run-time?
Date: Thu, 22 Apr 2010 12:48:10 +0400

thanks, but actually by saying "at run-time" I mean that
it is decided dynamically how to parse an input string. I want to write flexible
formatter of incoming documents of different structures. And metadata from that 
texts will be retrieved according to some files that contain grammar. It
would be useful for write another file of grammar, than rewriting the code.
;)

> Hi, Ламер,
> try to use the "--parse" action of Grammatica:
> [...]
> --parse <file>
> Debugs the grammar by using it to parse the specified
> file. No code has to be generated for this.
> [...]
> Grammatica can be used for parsing and tokenizing files, even though no 
> parser has been generated. This feature can be very useful for testing and 
> debugging grammars, as illustrated in the figure below.
> # java -jar grammatica-1.5.jar test.grammar --parse test.data
> [...]
> (from http://grammatica.percederberg.net/doc/release/manual/commandline.html)
> Good luck!
> Oliver
> Ламер <address@hidden>
> Sent by: address@hidden 05:48
> Please respond to
> address@hidden
> To
> address@hidden 
> cc
> Subject
> [Grammatica-users] How can I generate grammar at run-time? 
> Hi,
> Is it possible to generate grammar on the fly. I want to parse an input text
> depending on the grammar_1 that will be taken at run-time. Parse this 
> grammar_1, generate grammar_2
> and parse the input text based on grammar_2.
> e.g.
> --------------------------------------------------------------------------------------------------------------------------------
> /** 
> *Grammar_1, it some language that tells to my parser in which form input text 
> will be,
> * like:
> */
> <<${title}>>, ${date}, ${time}, ${tvname} /${author}/ =${duration}=
> ${text}
> /* parse this grammar_1, generate grammar_2
> * for the input like the following one:
> */
> <<Evening News>>,12 november 2009, 19:30, KazakhstanTV /Name Surname/ =4,00=
> Some input text,sdlfjlskdjfk
> /**
> * At the end it should retrieve variables, like
> * ${title} = Evening News
> * ${date} = 12 november 2009
> * etc.
> */
> --------------------------------------------------------------------------------------------------------------------------------
> Thanks in advance, any help will be appreciated
> P.S. Sorry for any grammatical mistakes in English ;)
> _______________________________________________
> Grammatica-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/grammatica-users
> 

Здесь спама нет http://mail.yandex.ru/nospam/sign




reply via email to

[Prev in Thread] Current Thread [Next in Thread]