correct DCG descriptions of lists (#286)

This commit is contained in:
Mark Thom
2020-03-14 14:14:26 -06:00
parent 31258247b3
commit 97aab6950c
2 changed files with 3 additions and 3 deletions

View File

@@ -107,8 +107,7 @@ dcg_constr((_->_)). % 7.14.12 - if-then (existence implementation dep.)
% The principal functor of the first argument indicates % The principal functor of the first argument indicates
% the construct to be expanded. % the construct to be expanded.
dcg_cbody([], S0, S, S0 = S). dcg_cbody([], S0, S, S0 = S).
dcg_cbody([T|Ts], S0, S, Goal) :- dcg_cbody([T|Ts], S0, S, lists:append([T|Ts], S, S0)).
dcg_terminals([T|Ts], S0, S, Goal).
dcg_cbody(( GRFirst, GRSecond ), S0, S, ( First, Second )) :- dcg_cbody(( GRFirst, GRSecond ), S0, S, ( First, Second )) :-
dcg_body(GRFirst, S0, S1, First), dcg_body(GRFirst, S0, S1, First),
dcg_body(GRSecond, S1, S, Second). dcg_body(GRSecond, S1, S, Second).

View File

@@ -379,7 +379,8 @@ impl MachineState {
let output = self.print_with_locs(Addr::HeapCell(h), &wam.indices.op_dir); let output = self.print_with_locs(Addr::HeapCell(h), &wam.indices.op_dir);
self.reset_with_heap_preservation(); self.reset_with_heap_preservation();
Some(output.result())
Some(output.result()))
} }
} }
} }