Added pointless function requested by spec and the partial ability to parse polynomials with normal ops

This commit is contained in:
Hugo Sales 2018-12-20 22:45:58 +00:00
parent fffe104684
commit f9d579c494
1 changed files with 12 additions and 6 deletions

View File

@ -85,10 +85,16 @@ polyplay :-
%% Parsing failed
writeln("Could not parse input, so I didn't understand what you want.")
),
%% Go back to the beginning
polyplay
%% Go back to the beginning
polyplay
),
!.
!.
text2poly(S, P) :-
split_string(S, " ", "\r\t", LS),
parse_polynomial(T, LS, []),
polynomial_tree_to_polynomial(T, P1),
simpoly(P1, P).
%% process_input(+Tree) is det
%
@ -553,9 +559,9 @@ parse_power(TB) -->
%
% Associate an operator with a word
%
parse_operation(-) --> [minus].
parse_operation(+) --> [plus].
parse_operation(*) --> [times].
parse_operation(-) --> [minus] | [-].
parse_operation(+) --> [plus] | [+].
parse_operation(*) --> [times] | [*].
%% parse_polynomial_operand(-tree) is det
%