Sedlex + Menhir parser for both tty and file parsing

I am a great fan of Menhir, and have used it in several private language projects, using the ulexing
scanner generator to provide Unicode-capable scanners.

Alarmed by the obsolescence of ulexing, and needing a utf8-capable scanner in a hurry I decided to (teach myself to) use Sedlex. On the whole the experience was very satisfactory,
and I found it straightforward to produce a variant of the sedlexing library which supports
buffers with variable chunk sizes, thereby enabling efficient lexing on channels connected to
files as well as immediately responsive lexing on channels connected to terminals.

I also wanted to teach myself how to use the error-reporting, incremental, interfaces to Menhir-generated parsers. In the hope that it might be useful to others facing the same learning task, or the problem of adapting Sedlex for efficient interactive use, I have placed the example mock-S-Expression parser that resulted from this excursion in:

Git Repository: github.com/sufrin/InteractiveSedlexMenhirExample

6 Likes