[m-users.] Determinism issue with parser
Peter Wang
novalazy at gmail.com
Mon Jul 5 11:07:24 AEST 2021
On Mon, 05 Jul 2021 01:44:31 +1000 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
>
> 2021-07-04 23:17 GMT+10:00 "Sean Charles (emacstheviking)" <objitsu at gmail.com>:
>
> > If I had some good clean examples I think I’d be fine,
>
> Unfortunately, I don't think we have any. Most of our sample programs
> do not contain parsers. The ones that do, the parsers are either too simple
> (and thus not useful as models), too complex (too hard to understand
> to be models), or they parse something other than a list of lexemes.
> The closest thing I can think of is parser.m in the Mercury standard
> library, but I do warn you, it is significantly more complex than
> what I would expect the parser for an average DSL to be.
Here's Julien's JSON parser:
https://github.com/juliensf/mercury-json/blob/master/src/json.json_parser.m#L101
And here's mine:
https://github.com/wangp/bower/blob/master/src/json.m#L52
(I saw "sexp" earlier. JSON and S-expressions are very similar.)
Peter
More information about the users
mailing list