grammatica-users
[Top][All Lists]
Advanced

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

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


From: Oliver Gramberg
Subject: Re: [Grammatica-users] How can I generate grammar at run-time?
Date: Thu, 22 Apr 2010 10:04:24 +0200


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

22.04.2010 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


reply via email to

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