Scryer-prolog: Feature suggestion: Make WAM instructions inspectable

Created on 9 Sep 2019  路  5Comments  路  Source: mthom/scryer-prolog

For some users, and for didactic purposes, it is useful to inspect the WAM instructions that Scryer Prolog generates.

Ideally, the WAM instructions of a predicate can be made available as a Prolog term.

Please also see https://stackoverflow.com/questions/57736615/how-can-i-inspect-wam-code-in-sicstus-prolog, which emits WAM code on the toplevel.

All 5 comments

See src/prolog/lib/diag.pl.

Wow, many thanks!

I'm CCing @stefan-kral: Could you please have a look, is it useful for your use case?

A good next step would be something like portray_clause/1, to make the output of wam_instructions/2 easier on the eyes.

Yes, portray_clause/1 would definitely be a very welcome addition!

I am frequently using portray_clause/1 to emit output (for example, solutions of CSP problems), because in this way I can then easily read and analyze the output again with read/1.

For portray_clause/1 consider to use the write option variable_names/1

Was this page helpful?
0 / 5 - 0 ratings