swipldcgtut
swipldcgtut copied to clipboard
A tutorial for DCG's in swi-Prolog
if the suffixes don't match it just matches 'anything' - suspect the 'anything' got added later. Ooops! point of exercise is that the args have to be the same.
https://github.com/SWI-Prolog/swipl-devel/issues/481
Was: http://www.swi-prolog.org/pldoc/doc/swi/library/dcg/basics.pl which is now an access denied error. Update to a Google search result: http://www.swi-prolog.org/pldoc/doc/_SWI_/library/dcg/basics.pl which looks right enough to be useful.
http://www.swi-prolog.org/pldoc/doc_for?object=section%283,%27A.19.1%27,swi%28%27/doc/Manual/pio.html%27%29%29 need to rewrite dcg tutorial to cover phrase_from_stream(:Grammer, +Stream) syntax_error(+Error)// lazy_list_location(-Location)// lazy_list_character_count(-CharCount)// This means not only rewrite of error location reporting, but dealing with phrase_from_stream as option for list...
Use tabling, or pass part parsed so far in to recursive call. https://groups.google.com/forum/#!topic/swi-prolog/5CoQLxXcI3A
License?
Hi Anne, thank you for the great tutorial! Unfortunately I could not find any information about its license. The same for your other tutorials. Would it be possible to provide...
Finally you use phrase/3, not phrase/2 in an example before having explained that: ``` ?- phrase(cliche, X, []), format('~s~n', [X]). ``` Enjoying your stuff though (^_^) Bye for now, Henk
Two other remarks regarding phrase/2: You write: To execute a grammar rule, we use Prolog's built-in phrase/2 predicate. The first argument is a DCG body. phrase(Body, Ls) is true iff...
Dear Anne, While refreshing my knowledge of DCGs, I stumbled on the double quoted strings, which - at least now and on a mac - (Multi-threaded, 64 bits, Version 7.2.3)...
and other nlp predicates