[m-users.] DCG-s in Mercury
Sean Charles (emacstheviking)
objitsu at gmail.com
Sun Apr 25 00:55:33 AEST 2021
Brilliant!
Thank you Julien.
> On 24 Apr 2021, at 12:53, Julien Fischer <jfischer at opturion.com> wrote:
>
>
> Hi Sean,
>
> On Sat, 24 Apr 2021, Sean Charles (emacstheviking) wrote:
>
>> Is there anywhere to be found a short, concise example of how to
>> create a DCG rule, just so I can see some examples of the mode
>> declarations, mine are not going to be used as generators, just as a
>> lever and a parser/AST builder. I use phrase_from_file/3 in SWI
>> Prolog, and the debugger means I can step through any rules that
>> aren’t doing what I think. So far in mercury I have not even worked
>> out how to start calling the head rule, if you call it that.
>
> Have a look at samples/calculator.m in the Mercury distribution.
> It contains an example of a parser for simple aritmetic expressions
> implemented using DCGs.
>
> Julien.
More information about the users
mailing list