Copyright (1997-2013) EDMGROUP Pty Ltd - EZY Prolog Reference

 EZY Prolog - HTML formatting for Prolog sources

New in EZY Prolog

Tutorials

Download EZY Prolog

main page

 

EZY Prolog has built-in functionality to convert Prolog program source into HTML file for documentation purposes.

 

To do so, load EZY Prolog program, compile it to memory and press HTML button.

 

Software will create HTML file and will open it in the WEB browser.

 

Note:

 

EZY Prolog can create HTML output only for programs, which passes compilation successfully. So, you will need to achieve successful compilation before creating HTML output.

 

EZY Prolog doesn't skips comments and predicate declarations in HTML output.

 

 

 

 

Coloring scheme

Text constants

"Hello from EZY PROLOG"

Variables

MAX

Standard Prolog predicates

write (MAX ),

Standard EZY Prolog predicates

for ( I , 1 , MAX )

User predicates

fwgc()

 

Sample HTML output of prolog program

 

prolog_main():-

write ( "Hello from EZY PROLOG" ),nl ,

MAX = 1 ,

for ( I , 1 , MAX ),

write ( "Runing test " , I ),nl ,

fwgc ,

I = MAX ,

! .

fwgc():-

go(state( east , east , east , east ),state( west , west , west , west )),

! .

go( S , G ):-

path( S , G ,[ S ], L ),nl ,

write ( "Solution of the Puzzle\n" ),

write_path( L ),

fail .

go( _ , _ )

path( S , G , L , L1 ):-

move( S , S1 ),

not (unsafe( S1 )),

not (member( S1 , L )),

path( S1 , G ,[ S1 |L], L1 ),

! .

path( G , G , T , T ):-

! .

move(state( X , X , G , C ),state( Y , Y , G , C )):-

opposite( X , Y ).

move(state( X , W , X , C ),state( Y , W , Y , C )):-

opposite( X , Y ).

move(state( X , W , G , X ),state( Y , W , G , Y )):-

opposite( X , Y ).

move(state( X , W , G , C ),state( Y , W , G , C )):-

opposite( X , Y ).

opposite( east , west )

opposite( west , east )

opposite( north , south )

opposite( south , north )

unsafe(state( F , X , X , _ )):-

opposite( F , X ).

unsafe(state( F , _ , X , X )):-

opposite( F , X ).

member( X ,[ X |_]).

member( X ,[ _ |L]):-

member( X , L ).

direction( east , west , "[--" )

direction( west , east , "--]" )

direction( north , south , "^^" )

direction( south , north , "~~" )

write_move(state( X , W , G , C ),state( Y , W , G , C )):-

! ,

direction( X , Y , Arrow ),

write ( Arrow , "The farmer crosses the river from " , X , " to " , Y ),

nl .

write_move(state( X , X , G , C ),state( Y , Y , G , C )):-

! ,

direction( X , Y , Arrow ),

write ( Arrow , "The farmer takes the Wolf from " , X , " of the river to " , Y ),

nl .

write_move(state( X , W , X , C ),state( Y , W , Y , C )):-

! ,

direction( X , Y , Arrow ),

write ( Arrow , "The farmer takes the Goat from " , X , " of the river to " , Y ),

nl .

write_move(state( X , W , G , X ),state( Y , W , G , Y )):-

! ,

direction( X , Y , Arrow ),

write ( Arrow , "The farmer takes the cabbage from " , X , " of the river to " , Y ),

nl .

write_path([ H1 , H2 |T]):-

! ,

write_move( H1 , H2 ),

write_path([ H2 |T]).

write_path( _ )

 

 


 

Copyright 1997-2013 EDMGROUP (Australia)

 

Last Updated: September 14, 2003