Skip to content
Austin edited this page Sep 2, 2017 · 5 revisions

Welcome to the cali.lang.base wiki!

This repository houses the base interpreter for the Cali programming language. This is meant to be the base interpreter to build upon or embed for a more useful coding experience. With that said this project can be used to run code from the command line.

Building

Cali requires a recent JDK (>= 1.6) and version of maven. To build, simply clone the repo and run maven package from the project directory.

> cd cali.lang.base/
> mvn clean package
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building cali-lang.jar 1.0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ cali.lang.base ---

...


[INFO] --- maven-assembly-plugin:2.4.1:single (make-assembly) @ cali.lang.base ---
[INFO] Building jar: /home/austin/git/cali.lang.base/cali.lang.base/target/cali.lang.base-1.0.1-jar-with-dependencies.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.812 s
[INFO] Finished at: 2017-08-28T17:21:11-07:00
[INFO] Final Memory: 24M/294M
[INFO] ------------------------------------------------------------------------

If all went well you should now have a target directory with the compiled software. Yes, score!

If you want to embed Cali interpreter within another project, all you need to do is grab the .jar file add it to the new project or add the Maven dependency.

<dependency>
    <groupId>com.cali-lang</groupId>
    <artifactId>cali.lang.base</artifactId>
    <version>1.0.1</version>
</dependency>

If you'd like to run some Cali code, read on. =)

Running Cali Code

Although this project is the base interpreter and is missing most common standard library functions one would want, the interpreter is able to execute code and the generated JAR file comes with a program entry point for running a code file from the command line.

After building (see above) you can run the built JAR file with no args to get the program information.

> java -jar target/cali.lang.base-1.0.1-jar-with-dependencies.jar 
Cali-Lang Version 1.0
Copyright 2017 Austin Lehman
Apache License Version 2


Error, incorrect number of arguments. Expecting script file name.

If you want to run the interpreter tests, run the following command. You should see something like the output below.

> java -jar target/cali.lang.base-1.0.1-jar-with-dependencies.jar tests/interpreter.ca
Running Test [ Cali-Lang Interpreter ]:
 *** (local assignment) Assign variable null. ... PASSED
 *** (local assignment) Assign variable bool. ... PASSED
 *** (local assignment) Assign variable int. ... PASSED

...

 *** (lang date) Date parse. ... PASSED
 *** (lang date) Date format. ... PASSED
 *** (lang date) Date is epoch. ... PASSED

TOTAL: 302 RAN: 302 PASSED: 302 
Elapsed: 0.282s

There's also a very basic helloworld.ca file in the examples directory you may run.

> java -jar target/cali.lang.base-1.0.1-jar-with-dependencies.jar examples/helloworld.ca
Wazzzap Cali!

OS Information
	OS Arch: amd64
	OS Name: Linux
	OS Version: 3.13.0-107-generic

...

You can create your own Cali code file and run it using the same syntax as used in the first two examples.

You can’t perform that action at this time.