plang [options] [filename.lp [arguments ...]]
The plang command is used to run applications that are written in the Plang logic programming language. The command-line starts with a list of options for the plang command itself. The options are followed by the name of the *.lp
source file to be executed. The remaining arguments are passed to the main
predicate of filename.lp.
-I dir
--import=dir
-L dir
--import-lib=dir
-m name
--main=name
main
. The predicate is assumed to take a single parameter corresponding to the list [filename.lp, arguments, ...].If the filename.lp and arguments are omitted, then plang will enter "shell mode". A brief introductory header is displayed, and then the user is prompted to enter Plang expressions for evaluation:
$ plang Plang version 0.0.1 Copyright (c) 2011 Southern Storm Software, Pty Ltd. Type 'help.' for help | ?-
Shell mode stops when the user types "exit." or "quit.", or otherwise causes an end-of-file indication on standard input.
Under Unix-like systems such as GNU/Linux, it is possible to mark filename.lp as an executable with chmod +x. Add the following line to the top of filename.lp:
#!/usr/bin/env plang
After that, the Plang application can be run directly:
$ ./filename.lp
The exit status will be zero if filename.lp was loaded without error and the main
predicate completed successfully. The exit status will be 1 if a load error occurred, the main
predicate failed, or an uncaught error was thrown using throw/1. If the application executes halt/0 or halt/1, then the exit status will be set accordingly.