In Hassan Aït-Kaci's "Warren's Abstract Machine: A Tutorial Reconstruction" Section 2.2, the orders for compilation of L0 queries are clear enough: registers must be allocated with left-to-right breadth-first search and code must be generated with left-to-right post-order depth-first search.
In Section 2.3, the order for register allocation (of L0 programs) is clear: left-to-right breadth-first search. The order for code generation isn't. With the only example given, I can't tell if I should use BFS or DFS to generate code.
Can someone give me the WAM code for the following L0 program?
p(q(r(a)),s(b)).
I put your program in sample.pl:
$ cat sample.pl p(q(r(a)),s(b)).
Using GNU Prolog, I then did:
$ gplc -w sample.pl
The following WAM instructions are then contained in sample.wbc:
clause(p(q(r(a)),s(b)),[
get_structure(q/1,0),
unify_structure(r/1),
unify_atom(a),
get_structure(s/1,1),
unify_atom(b),
proceed]).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With