Onion is an object-oriented and statically typed programming language. Source codes of Onion compiles into JVM class files as in-memory or real files.
Originally, Onion was written in Java. It has been rewritten in Scala completely except Parser, using JavaCC.
The compiler parses source code into an untyped AST and then performs type checking to produce a typed AST. The old intermediate representation (IRT) has been folded into this typed tree. Code generation now runs on the typed AST via a thin compatibility layer using ASM.
onionc [options] source files...- -classpath Set classpath of source files in compilation.
- -encoding Set encoding of source files.
- -d Set output directory of results.
- -maxErrorReports Set the maximum number of comiplation errors reported.
onionc compiles source files into class files in the directorys corresponding to module names
of source files rooted by "-d" option. If "-d" is not specified, the value of "-d" is specified as the current directory.
For example, if source files which module name is "org.onion_lang" is compiled, class files are generated under:
- Unix-like OS : org/onion_lang
- Windows: org\onion_lang
onion [options] source files... [command line arguments]
- -classpath classpath of source files in compilation.
- -encoding encoding of source files.
- -maxErrorReports the maximum number of comiplation errors reported.
onion compiles source files into in-memory class files and execute them. The entry point is:
- A main method if there is an explicit class definition and it have the main method.
- The main method of the class on the top.
- Otherwise, the first statement on the top.
-
Some compilation-time checks is not implemented yet. For example, It's not checked that abstract methods are implemented. Compiled codes maybe rejected by class file verifiers sometimes. If you find the problem, reporting it to help me.
-
Currently,
onionchas edge cases. The compiler crashes sometimes. The source codes in example directory compiles and is executed correctly. -
There are some partially supported features. For example,
finallyclause in try-catch is not supported yet.
This software includes softwares developed by Apache Software Foundation.