• Re: DCG restrictions on the left-hand side [Novacore]

    From Mild Shock@21:1/5 to Mild Shock on Tue Jul 30 20:43:44 2024
    In Novacore we are lucky, its a side effect of
    phrase translating the head and a multi-file check:

    ?- [user].
    p;q --> r.
    Fehler: Kann Prädikat ;/2 nicht umdefinieren, nicht als Mehrdateien
    markiert.

    But might work out differently if a DCG is expanded
    and asserted. Ok, its actually not so bad:

    ?- expand_term((p;q --> r), X), assertz(X).
    Fehler: Kann Prädikat ;/2 nicht aktualisieren.
    user auf 1


    Mild Shock schrieb:
    Guess how many newer Prolog systems allow this here:

    ?- [user].
    p;q --> r.
       true.

    On the other hand SWI-Prolog disallows it:

    ?- [user].
    p;q --> r.

    ERROR: user://1:29:
    ERROR:    No permission to define dcg_nonterminal `p;q'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Tue Jul 30 20:45:33 2024
    This was discussed here:

    Definite Clause Grammars Harmonization Proposal
    Last edit jschimpf? October 20, 2016, at 12:42 AM https://eclipseclp.org/wiki/Prolog/DCG

    Not sure why Scryer Prolog doesn't implement it.

    Mild Shock schrieb:

    In Novacore we are lucky, its a side effect of
    phrase translating the head and a multi-file check:

    ?- [user].
    p;q --> r.
    Fehler: Kann Prädikat ;/2 nicht umdefinieren, nicht als Mehrdateien markiert.

    But might work out differently if a DCG is expanded
    and asserted. Ok, its actually not so bad:

    ?- expand_term((p;q --> r), X), assertz(X).
    Fehler: Kann Prädikat ;/2 nicht aktualisieren.
        user auf 1


    Mild Shock schrieb:
    Guess how many newer Prolog systems allow this here:

    ?- [user].
    p;q --> r.
        true.

    On the other hand SWI-Prolog disallows it:

    ?- [user].
    p;q --> r.

    ERROR: user://1:29:
    ERROR:    No permission to define dcg_nonterminal `p;q'


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to All on Tue Jul 30 20:39:58 2024
    Guess how many newer Prolog systems allow this here:

    ?- [user].
    p;q --> r.
    true.

    On the other hand SWI-Prolog disallows it:

    ?- [user].
    p;q --> r.

    ERROR: user://1:29:
    ERROR: No permission to define dcg_nonterminal `p;q'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Wed Jul 31 08:07:22 2024
    I think its worth adopting this behaviour:

    /* Scryer Prolog */
    ?- a-->b.
    error(existence_error(procedure,(-->)/2),(-->)/2).
    ?- assertz((a-->b)).
    error(permission_error(modify,static_procedure,(-->)/2),assertz/1).
    ?- a-->b.
    error(existence_error(procedure,(-->)/2),(-->)/2).

    Mild Shock schrieb:
    Although SWI-Prolog implements a lot of checks.
    It still allows this one:

    ?- a-->b.
    ERROR: Unknown procedure: (-->)/2

    ?- assertz((a-->b)).
    true.

    ?- a-->b.
    true.

    Scryer Prolog managed to prevent this, in that
    the assertz/1 throws an error.

    Think will finally adopt this behaviour to
    prevent the end-user from accidentially

    fiddling with (-->)/2.

    Mild Shock schrieb:

    This was discussed here:

    Definite Clause Grammars Harmonization Proposal
    Last edit jschimpf? October 20, 2016, at 12:42 AM
    https://eclipseclp.org/wiki/Prolog/DCG

    Not sure why Scryer Prolog doesn't implement it.

    Mild Shock schrieb:

    In Novacore we are lucky, its a side effect of
    phrase translating the head and a multi-file check:

    ?- [user].
    p;q --> r.
    Fehler: Kann Prädikat ;/2 nicht umdefinieren, nicht als Mehrdateien
    markiert.

    But might work out differently if a DCG is expanded
    and asserted. Ok, its actually not so bad:

    ?- expand_term((p;q --> r), X), assertz(X).
    Fehler: Kann Prädikat ;/2 nicht aktualisieren.
         user auf 1


    Mild Shock schrieb:
    Guess how many newer Prolog systems allow this here:

    ?- [user].
    p;q --> r.
        true.

    On the other hand SWI-Prolog disallows it:

    ?- [user].
    p;q --> r.

    ERROR: user://1:29:
    ERROR:    No permission to define dcg_nonterminal `p;q'




    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Wed Jul 31 07:55:14 2024
    Although SWI-Prolog implements a lot of checks.
    It still allows this one:

    ?- a-->b.
    ERROR: Unknown procedure: (-->)/2

    ?- assertz((a-->b)).
    true.

    ?- a-->b.
    true.

    Scryer Prolog managed to prevent this, in that
    the assertz/1 throws an error.

    Think will finally adopt this behaviour to
    prevent the end-user from accidentially

    fiddling with (-->)/2.

    Mild Shock schrieb:

    This was discussed here:

    Definite Clause Grammars Harmonization Proposal
    Last edit jschimpf? October 20, 2016, at 12:42 AM https://eclipseclp.org/wiki/Prolog/DCG

    Not sure why Scryer Prolog doesn't implement it.

    Mild Shock schrieb:

    In Novacore we are lucky, its a side effect of
    phrase translating the head and a multi-file check:

    ?- [user].
    p;q --> r.
    Fehler: Kann Prädikat ;/2 nicht umdefinieren, nicht als Mehrdateien
    markiert.

    But might work out differently if a DCG is expanded
    and asserted. Ok, its actually not so bad:

    ?- expand_term((p;q --> r), X), assertz(X).
    Fehler: Kann Prädikat ;/2 nicht aktualisieren.
         user auf 1


    Mild Shock schrieb:
    Guess how many newer Prolog systems allow this here:

    ?- [user].
    p;q --> r.
        true.

    On the other hand SWI-Prolog disallows it:

    ?- [user].
    p;q --> r.

    ERROR: user://1:29:
    ERROR:    No permission to define dcg_nonterminal `p;q'



    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)