Re: Lazy/tolerant parsers

"Dmitry A. Kazakov" <>
14 Jul 2004 12:09:31 -0400

          From comp.compilers

Related articles
Lazy/tolerant parsers (2004-07-13)
Re: Lazy/tolerant parsers (Dmitry A. Kazakov) (2004-07-14)
Re: Lazy/tolerant parsers (2004-07-15)
Re: Lazy/tolerant parsers (Dmitry A. Kazakov) (2004-07-17)
| List of all articles for this month |

From: "Dmitry A. Kazakov" <>
Newsgroups: comp.compilers
Date: 14 Jul 2004 12:09:31 -0400
Organization: Compilers Central
References: 04-07-029
Keywords: parse
Posted-Date: 14 Jul 2004 12:09:31 EDT

On 13 Jul 2004 22:30:21 -0400, Akhilesh Mritunjai wrote:

> I tried searching in archives, but could not find helpful results.
> I have a (Ada like) grammar for which I need to create a parser which
> should be usable for code as user types (syntax highlighting, code
> assist etc). So the parser should correctly deal with -
> - partial sententences
> - Incomplete/missing closures
> Which method would you recommend to write such a parser ?

You can take a look at

it has a parser to deal with expressions. (There is an example of full
Ada 95 expression parser and tree generator). The parser stops at
something it cannot recognize. At this point one can determine its
state. I.e. how many unclosed brackets, missing right operands etc you
have. One can use some kind of pattern matching to jump over an
indigestible part (not a name or literal, but just rubbish) and
continue. Recognized tokens contain location info, which can be used
for highlighting. Well, statements like if-then-else can be treated as
brackets, I suppose.

Dmitry A. Kazakov

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.