CFG/DCG Demo 2 - CSC 366 Home Page - CSC 366 A14 Page - Code 2

...@...:~/Desktop/dcg$ swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 7.6.1)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

For online help and background, visit http://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).

?- consult('dcg_int.pro').
true.

?- parser.
|: use whatever to make whatever.
problem(numbers(12,10,12,1,15),goal(10))
|: use five twos to make two.
problem(numbers(2,2,2,2,2),goal(2))
|: use one two three four five to make six.
Not a sentence ...
|: use one two three four and five to make six.
problem(numbers(1,2,3,4,5),goal(6))
|: can you make five from two threes and three ones?
problem(numbers(3,3,1,1,1),goal(5))
|: ^C
^C

WARNING: By typing Control-C twice, you have forced an asynchronous
WARNING: interrupt.  Your only SAFE operations are: c(ontinue), p(id),
WARNING: s(stack) and e(xit).  Notably a(abort) often works, but
WARNING: leaves the system in an UNSTABLE state

Action (h for help) ? abort
% Execution Aborted

?- interpreter.
|: use whatever to make whatever.
( 10 * ( ( 0 * 8 ) * ( 14 + 10 ) ) )
|: use five twos to make two.
( 2 + ( ( 2 + 2 ) - ( 2 + 2 ) ) )
|: can you make five from two threes and three ones?
( 1 + ( ( 3 + 3 ) - ( 1 + 1 ) ) )
|: write three in terms of numbers one through five.
( ( ( 1 + 2 ) + ( 3 * 4 ) ) / 5 )
|: use one and three and five and six and zero to make one.
( 0 - ( ( 1 - 3 ) - ( 5 - 6 ) ) )
|: can you make nine from five threes?
( ( ( 3 + 3 ) + ( 3 + 3 ) ) - 3 )
|: ^C
^C

WARNING: By typing Control-C twice, you have forced an asynchronous
WARNING: interrupt.  Your only SAFE operations are: c(ontinue), p(id),
WARNING: s(stack) and e(xit).  Notably a(abort) often works, but
WARNING: leaves the system in an UNSTABLE state

Action (h for help) ? abort
% Execution Aborted
?-