[m-dev.] Proposal: parsing module for the library.

Zoltan Somogyi zs at csse.unimelb.edu.au
Tue Jan 13 16:01:38 AEDT 2009


On 13-Jan-2009, Ralph Becket <rafe at csse.unimelb.edu.au> wrote:
> eof(Src, unit, !PS) :-
>     !.PS = Src ^ input_length.
> 
> char(Src, Char, PS, PS + 1) :-
>     PS < Src ^ input_length,
>     Char = Src ^ input_string ^ unsafe_elem(PS).
> 
> char_in_class(Src, CharClass, Char) -->
>     char(Src, Char),
>     { string.contains_char(CharClass, Char) }.

These three predicates use three different ways to represent access to the
parser state: state variables, separate variables, and DCG notation.
You definitely want to use only one consistently throughout the module,
and I strongly suggest that it be state variable notation.

I agree with Julien's comments.

Zoltan.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the developers mailing list