Multifile func/3.
This commit is contained in:
parent
cd60816429
commit
79aa2f972d
|
|
@ -1,7 +1,8 @@
|
||||||
GPLC_OPTIONS="--min-size"
|
#GPLC_OPTIONS=--min-size
|
||||||
|
GPLC_OPTIONS=--no-top-level
|
||||||
|
|
||||||
thun: thun.pl parser.pl defs.pl main.pl
|
thun: thun.pl parser.pl defs.pl main.pl math.pl Makefile
|
||||||
gplc $(GPLC_OPTIONS) -o thun thun.pl parser.pl defs.pl main.pl
|
gplc $(GPLC_OPTIONS) -o thun thun.pl parser.pl defs.pl main.pl math.pl
|
||||||
|
|
||||||
defs.pl: meta-defs.pl parser.pl defs.txt thun.pl
|
defs.pl: meta-defs.pl parser.pl defs.txt thun.pl
|
||||||
gprolog \
|
gprolog \
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,9 @@ loop( Line, In, Out) :-
|
||||||
loop(NextLine, S, Out).
|
loop(NextLine, S, Out).
|
||||||
|
|
||||||
|
|
||||||
do_line(Line, In, Out) :- phrase(joy_parse(E), Line), thun(E, In, Out).
|
do_line(Line, In, Out) :-
|
||||||
|
phrase(joy_parse(E), Line),
|
||||||
|
thun(E, In, Out).
|
||||||
do_line(_Line, S, S) :- write('Err'), nl.
|
do_line(_Line, S, S) :- write('Err'), nl.
|
||||||
|
|
||||||
prompt :- write(`joy? `).
|
prompt :- write(`joy? `).
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
:- multifile(func/3).
|
||||||
func(+, [A, B|C], [D|C]) :-
|
func(+, [A, B|C], [D|C]) :-
|
||||||
E =.. [+, B, A],
|
E =.. [+, B, A],
|
||||||
catch(D is E, _, D = E).
|
catch(D is E, _, D = E).
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ writeln(Stream, Thing) :-
|
||||||
|
|
||||||
do :-
|
do :-
|
||||||
open(`math.pl`, write, Stream),
|
open(`math.pl`, write, Stream),
|
||||||
|
write(Stream, `:- multifile(func/3).`), nl(Stream),
|
||||||
print_o(Stream, math_operator(Op)),
|
print_o(Stream, math_operator(Op)),
|
||||||
print_o(Stream, comparison_operator(Op)),
|
print_o(Stream, comparison_operator(Op)),
|
||||||
print_o(Stream, comparison_operator(Op, Po)),
|
print_o(Stream, comparison_operator(Op, Po)),
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
*/
|
*/
|
||||||
% :- dynamic(func/3).
|
% :- dynamic(func/3).
|
||||||
% :- discontiguous(func/3).
|
% :- discontiguous(func/3).
|
||||||
|
:- multifile(func/3).
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Interpreter
|
Interpreter
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue