From: Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Parser interface design
Date: Fri, 08 Apr 2011 12:06:43 -0700
Date: 2011-04-08T12:06:43-07:00 [thread overview]
Message-ID: <inno97$klb$1@tornado.tornevall.net> (raw)
In-Reply-To: <slrnipu5cr.2fnq.lithiumcat@sigil.instinctive.eu>
On 04/08/2011 07:03 AM, Natasha Kerensikova wrote:
>
> Yes, as I said in my reply to Dmitry, I thought of disabling in the
> parser the feature associated to a callback set to null. In the
> "foo *bar* baz" example I provided, using a No_Op for Emphasis would
> result in "<p>foo baz</p>", while disabling the emphasis feature means
> considering the star as an inactive character, resulting in
> "<p>foo *bar* baz</p>".
Without knowing much about your domain, I'd think
type Parse_Result_Info is ...;
generic -- Parse
with procedure Render (Parse_Result : in Parse_Result_Info);
procedure Parse (...);
would provide you with this kind of discrimination. A Render that does something
for the '*' construct would recognize it and take the desired action, while a
Render that doesn't would give the results you want. Another advantage is that
you have no limit on the number of constructs that you can handle, rather than
the fixed number required when using a separate subprogram for each construct.
The limitation here seems to be that Parse is going to parse according to a
fixed grammar. Perhaps it could be given a grammar as a parameter to make it
more flexible, or it may be possible to provide more generic formal parameters
that define how it parses.
--
Jeff Carter
"Help! Help! I'm being repressed!"
Monty Python & the Holy Grail
67
next prev parent reply other threads:[~2011-04-08 19:06 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-06 10:11 Parser interface design Natasha Kerensikova
2011-04-06 12:17 ` Georg Bauhaus
2011-04-07 18:56 ` Natasha Kerensikova
2011-04-08 11:49 ` Stephen Leake
2011-04-06 12:20 ` Dmitry A. Kazakov
2011-04-07 19:14 ` Natasha Kerensikova
2011-04-07 20:31 ` Dmitry A. Kazakov
2011-04-08 13:51 ` Natasha Kerensikova
2011-04-08 14:21 ` Dmitry A. Kazakov
2011-04-12 15:58 ` Natasha Kerensikova
2011-04-12 17:14 ` Dmitry A. Kazakov
2011-04-06 15:51 ` Georg Bauhaus
2011-04-07 19:44 ` Natasha Kerensikova
2011-04-07 20:52 ` Dmitry A. Kazakov
2011-04-07 22:09 ` Simon Wright
2011-04-08 14:03 ` Natasha Kerensikova
2011-04-08 19:06 ` Jeffrey Carter [this message]
2011-04-08 19:59 ` Simon Wright
2011-04-12 16:13 ` Natasha Kerensikova
2011-04-12 17:22 ` Dmitry A. Kazakov
2011-04-12 19:02 ` Simon Wright
2011-04-13 8:20 ` Natasha Kerensikova
2011-04-13 8:37 ` Dmitry A. Kazakov
2011-04-13 11:06 ` Georg Bauhaus
2011-04-13 12:46 ` Dmitry A. Kazakov
2011-04-13 22:33 ` Randy Brukardt
2011-04-14 6:55 ` Natasha Kerensikova
2011-04-15 0:22 ` Randy Brukardt
2011-04-12 21:54 ` Randy Brukardt
2011-04-07 22:13 ` Georg Bauhaus
2011-04-08 15:30 ` Natasha Kerensikova
2011-04-07 0:36 ` Randy Brukardt
2011-04-08 11:16 ` Brian Drummond
2011-04-19 9:08 ` Natasha Kerensikova
2011-04-19 12:35 ` Ludovic Brenta
2011-04-20 10:44 ` Brian Drummond
2011-04-19 17:28 ` Jeffrey Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox