2.2. Run an interpreter as a daemon

Interpreters derived from DynSem specifications can be run as daemons. They run as a background process which accepts client requests for program evaluation. Running interpreters in the background significantly reduces the startup time of the interpreter.

2.2.1. Requirements

The daemon mode uses Nailgun for Java to launch background processes and make requests. On OS X you can install Nailgun using Homebrew:

brew install nailgun

2.2.2. Launching an interpreter daemon

If you have enabled generation of the interpreter project in dynsem.properties:

project.create = true

upon generation of an interpreter three files will be generated in the root of the interpreter project. Assuming your language is named simpl these files will be:

  • simpl-server
  • simpl-client
  • simpl (Daemon).launch

Launch an interpreter daemon by running the simpl-server shell script or by launching the simpl (Daemon) launch configuration from Eclipse. To quit the daemon simply quit the process or run the stop command from a shell:

ng ng-stop

To evaluate a program you can either use the simpl-client:

./simpl-client yourprogram.smpl

or invoke the ng command:

ng simpl yourprogram.smpl

Warning

Nailgun daemon are not secure. For more information see the Nailgun website