Chapter 13
Installing and Running the Panini Compiler

13.1 Downloading the Compiler

The Panini compiler can be obtained in the following forms:

For starting out, we would recommend the pre-built binaries that account for all dependencies. The following instructions assume the use of the pre-built package.

13.2 Structure of Panini Distribution

The archive file contains the following:

  • bin: Executable versions of the Panini compiler for both *nix and WIN environments.
  • lib: Jars files for panini.
  • examples: Some small examples of new Panini features.
  • license: License agreements under with the Panini Compiler and associated tools are available.
  • README: A textual version of this page.

13.3 Requirements for Running Panini Compiler

  • Java Runtime Environment(JRE) 1.6 or greater.
  • Apache Ant is also recommended. It available from the URL

13.4 Running the Panini Compiler

The Panini compiler can be used in two ways:

  • like javac from the command-line
  • as a replacement builder for javac in the javac ant task.

The following sections describe usage.

13.5 Running the Panini Compiler from the command-line

The bin folder in this distribution contains scripts that can be used to run the Panini compiler and to start compiled Panini programs.

  • bin/panc and bin/panini : the command-line interfaces for *nix systems.
  • bin/panc.bat and bin/panini.bat : the command-line interface for WIN systems.

The panc and panc.bat scripts have an interface like javac, the standard Java compiler. The panini and panini.bat have an interface like java, the standard Java virtual machine.

13.6 Compiling Examples from Command-Line

Examples of some small Panini programs are located in the examples folder. To compile an example, navigate to its directory and use Panini compiler just like javac. For example, to manually compile the Dining Philosophers example, navigate to the examples directory and type


Running compiled Panini programs requires the panini runtime be on the JVM classpath. The required runtime classes are in $PANC_HOME/lib/panini_rt.jar. The panini script, packaged in the bin directory, automatically starts a JVM with the correct library on the classpath.

Use $PANC_HOME/bin/panini AppEntry to run these programs.

13.7 Running the Panini Compiler from Within Ant

The panini compiler can be used in an ant build script by replacing the jar file used by the javac task. See the OpenJDK notes in the Ant manual at for more information.

<pre class="brush:␣xml;} 
<property name="panc.jar" 
    <javac fork="yes} 
<target name="build" > 
    <panc srcdir="src" 

13.8 Translating Panini into Java

The panini ant task can also translate Panini programs into pure Java programs. After translation, a Panini program can be compiled with any standard Java compiler. To translate a Panini program set the dotranslate attribute to yes. For example:

<panc dotranslate="yes" srcdir="${source}" destdir="${output}" 

will translate all the Panini source files in the ${source} to Java files in the ${output} directory. The translation attribute does not support a nested package structure for the source files. If the translation option is used, all the source files must be in the default package. When compiling with javac, panini_rt.jar must be on the classpath. The build files for the included examples use the translation/javac strategy to produce runnable byte code.

13.9 Acknowledgments and Licensing

The Panini compiler builds on the OpenJDK java compiler available at the URL

All necessary licenses are included in the license directory. The Panini compiler is licensed under the Mozilla Public License version 1.1 (MPL 1.1) license. You may obtain a copy of the license at the URL