[mercury-users] using mercury for parsing/scanning
Dave Slutzkin
dave_slutzkin at yahoo.com
Mon Dec 31 14:41:05 AEDT 2001
--- Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 31-Dec-2001, Dave Slutzkin
> <dave_slutzkin at yahoo.com> wrote:
> > When using DCGs to scan character strings, is
there an
> > alternative to this:
> >
> > keyword -->
> > ['K','E','Y','W','O','R','D']
>
> You can use
>
> keyword --> string("KEYWORD").
>
> where string//1 can be defined as
<snipped code>
But surely this is inefficient? Doing the conversino
every time the predicate is called?
Another question:
How do I write a char literal? '@' works fine, but
'.' or ',' gives me problems (they look like operators
to the compiler). "'.'" is a string not a char. 0'.
is an int not a char. Is there such thing as a char
literal in mercury?
thanks,
Dave
(dcs at students.cs.mu.oz.au)
http://my.yahoo.com.au - My Yahoo!
- It's My Yahoo! Get your own!
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list