comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: [Slightly OT] How to process lightweight text markup languages?
Date: Fri, 23 Jan 2015 04:24:51 -0600
Date: 2015-01-23T04:24:51-06:00	[thread overview]
Message-ID: <85h9vh94lo.fsf@stephe-leake.org> (raw)
In-Reply-To: slrnmbt8mf.19vl.lithiumcat@nat.rebma.instinctive.eu

Natasha Kerensikova <lithiumcat@instinctive.eu> writes:

> This led me to the conclusion that the only solutions are backtracking
> and simultaneously parsing all available possibilities (i.e. using a
> nondeterministic automaton). Considering the current state of computing,
> I should probably go for backtracking.

I don't follow; why is backtracking better than parallel parsing? They
both search the same tree of possible grammar sentences; it's just
depth-first vs breadth-first search.

> Basic backtracking would be pushing the current state when encountering
> an opening marker, and if the end is reached with a non-empty stack, pop
> the top-most state, replace the opening marker by the literal
> sequence of its representation, and restart parsing.

Right.

In parallel parsing, you don't wait for the first one to fail; you just
assume it will.

> If I'm not mistaken, adding precedences to the mix would just change the
> meaning of "end is reached" in the previous paragraph: it would not only
> mean the end of input, but also the ending marker of any
> higher-precedence construct currently in the stack.

Sounds right.

> Am I right so far? Am I missing something?

You are only missing an implemention of a parallel parser and lexer.
There is an example of the first in OpenToken; the second should not be
hard.

-- 
-- Stephe


  parent reply	other threads:[~2015-01-23 10:24 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-18 18:04 [Slightly OT] How to process lightweight text markup languages? Natasha Kerensikova
2015-01-18 20:21 ` Dmitry A. Kazakov
2015-01-19 11:09   ` G.B.
2015-01-19 13:21     ` Dmitry A. Kazakov
2015-01-19 16:58       ` G.B.
2015-01-19 17:58         ` Dmitry A. Kazakov
2015-01-20 14:41           ` Robert A Duff
2015-01-19 20:12         ` Randy Brukardt
2015-01-19 21:37           ` gautier_niouzes
2015-01-20  8:44             ` Dmitry A. Kazakov
2015-01-20 12:36               ` G.B.
2015-01-20 13:14                 ` Dmitry A. Kazakov
2015-01-20 20:36               ` Shark8
2015-01-20 21:16                 ` Dmitry A. Kazakov
2015-01-20 22:55                   ` J-P. Rosen
2015-01-21  8:35                     ` Dmitry A. Kazakov
2015-01-20 19:19             ` Natasha Kerensikova
2015-01-20 21:43             ` Randy Brukardt
2015-01-20 19:16           ` Natasha Kerensikova
2015-01-20 18:47   ` Natasha Kerensikova
2015-01-20 19:44     ` Dmitry A. Kazakov
2015-01-20 22:00       ` Randy Brukardt
2015-01-22 13:41         ` Natasha Kerensikova
2015-01-22 18:38           ` Dmitry A. Kazakov
2015-01-22 21:48             ` Randy Brukardt
2015-01-23 10:24     ` Stephen Leake [this message]
2015-01-21 14:54 ` Stephen Leake
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox