First of all, the Cyan compiler works in Windows. A jar file used to work in Linux too but probably this is not true anymore. Anyway, it may work, although there is no guarantee about that.
The available downloads are:
- Compiler itself with the libraries. The source code of the compiler is in directory ‘src’. The compiler name is ‘saci’ after the character of brazilian folklore
- Tests. You can use these to see some working Cyan code
Suppose you downloaded and uncompressed the files above to directory
The last directory,
src, is only necessary if you intend to compile the Cyan compiler or to look at the code.
Now open a Command prompt by pressing the Windows key (Win) + R and typing “cmd” (without quotes) and ENTER. Go to the directory
lib and type
Saci will guide you to configure the environment variable. After that, close this command prompt windows and open it again (to read the new values of the environment variables). Now you can use the compiler.
If that does not work, do the following. Create an environment variable called
CYAN_HOME whose contents is
Create an environment variable called
JAVA_HOME_FOR_CYAN whose contents is the directory of JDK 1.8. Something as:
The Cyan compiler has been tested only with Java 1.8 (use the most recent version of JDK 1.8). A newer version of JDK, like 1.9, may not work. Remember that, if an environment variable is set using the Windows 10 menus, it is only visible in command prompts and PowerShell windows opened after the variable was set. If variable
JAVA_HOME_FOR_CYAN is not set, the Cyan compiler will use a Java subdirectory of
that corresponds to a newer JDK version.
To compile and execute the project of the directory ‘helloWorld’ type the following in the Windows command prompt:
C:\> cd Cyan\lib
C:\Cyan\lib> .\saci "C:\Cyan\cyanTests\helloWorld"
To run the program again, type
The compiler will create a .cmd file with the name of the last directory of the path. You can compile without executing by using option -noexec:
C:\Cyan\lib> .\saci -noexec "C:\Cyan\cyanTests\helloWorld"
In general, type
C:\Cyan\lib> .\saci "C:\Cyan\cyanTests\myFirstProgram"
myFirstProgram is the directory with the Cyan packages. There should be at least one directory ‘main’ with a file ‘Program.cyan’ in it.
In Linux, if you want to try, use
$ cd Cyan/lib
$ java -jar saci.jar "~/Cyan/cyanTests/helloWorld"
There is no equivalent of a .cmd file for Linux.
The Cyan compiler produces Java code that is then compiled and run. The Java code produced is put in a directory
~/Cyan/cyanTests/java-for-master for a project that is in directory
The compiler has some options:
- -nojavac to compile to Java only. The Java compiler is not called;
- -noexec to compile the Cyan code to Java but without running it;
- -java if Java code is used in the Cyan code;
- -args argList
arguments to the Cyan program. The arguments that follow ‘-args’, argList, will be passed to the Cyan program if it is to be executed. It is not an error to have both options -noexec and -args. Of course, this should be the last option in the command line;
- -sourcePath aPath
for supplying ‘aPath’ for the Java compiler. This option can appear any number of times. Each time can be composed by multiple paths, separated by ‘;’;
- -cp aPath
for supplying ‘aPath’ for the Java interpreter. This option can appear any number of times. Each time can be composed by multiple paths, separated by ‘;’.
Read these instructions to compile the Cyan compiler.
There is a feature of the Cyan language called “Codeg” (code + egg). It needs a plugin to the IDE to work. See the instructions on how to install and use it here.
The license of the compiler source code is GNU Public License version 3. There is not much documentation on the compiler because it is constantly been changed.
The compiler construction received funding from FAPESP, a research financial agency of the State of São Paulo, Brazil. The process number is 2014/01817-3.