[mercury-users] Mercury Superhomogeneous form
Peter Ross
pro at missioncriticalit.com
Thu Oct 21 11:43:06 AEDT 2010
Hi Celine,
2010/10/21 CĂ©line Dandois <cda at info.fundp.ac.be>:
> I am currently working on a static code analysis for Prolog programs. I
> would like to presuppose to this analysis that the Prolog source code is in
> superhomogeneous form, like the one defined for Mercury. So I was wondering
> if it is possible to use the module from the Mercury compiler, performing
> transformation in superhomogeneous form, with a Prolog code. What do you
> think about that?
>
I don't think it would be easy to use the Mercury module to output the
code in the format that you would want.
> Does this module take as input a source code? Does it produce a new source
> code file as output? Can I find some precise specification about this module
> somewhere?
>
I would suggest looking at instead the parser, term and term_io
modules from the standard library.
Your code would look something like the following
translate(!IO) :-
parser.read_term(ReadTermResult, !IO),
( ReadTermResult = term(Varset, Term0) ->
convert_term_to_shf(Varset, Term0, Term),
term_io.write_term(Varset, Term, !IO),
translate(!IO)
;
true
).
You then just need to write convert_term_to_shf, which is not terribly
difficult.
Then when you ran this program it would take a prolog program on std
input and convert it into a shf equivalent program.
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to: mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions: mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the users
mailing list