]> Repositorios git - scryer-prolog.git/commitdiff
introduce and use nonterminal list//1
authorMarkus Triska <[email protected]>
Mon, 30 Mar 2020 23:28:16 +0000 (01:28 +0200)
committerMarkus Triska <[email protected]>
Mon, 30 Mar 2020 23:28:16 +0000 (01:28 +0200)
Example:

    ?- phrase(list(Ls), Ls0).
       Ls = [], Ls0 = []
    ;  Ls = [_A], Ls0 = [_A]
    ;  Ls = [_A,_B], Ls0 = [_A,_B]
    ;  Ls = [_A,_B,_C], Ls0 = [_A,_B,_C]
    ;  ...

src/prolog/examples/bimetatrans_ruleml.pl

index 7c0028d58f8df314c610630f2ed3bd8fefa71003..ea56c2e2769825e60ba853eb0261a9647a34f264 100644 (file)
@@ -283,10 +283,13 @@ sign('+') --> "+".
 
 double_quote('"') --> "\"".
 
-list_ws(String) -->
-    partial_string(String),
+list_ws(Ls) -->
+    list(Ls),
     ws.
 
+list([]) --> [].
+list([L|Ls]) --> [L], list(Ls).
+
 /*
  * ruleml_assert_item//1 specifies the elements of RuleML that may
  * appear as items in a RuleML Assert performative, an implicitly