Skip to content
Onion - statically typed object-oriented programming language
Scala Java Other
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.

Onion - A Statically Typed Programming Language on JVM Build Status

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.




    onionc [options] source files...

Available options:

  • -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]

Available options

  • -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:

  1. A main method if there is an explicit class definition and it have the main method.
  2. The main method of the class on the top.
  3. 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, onionc has 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, finally clause in try-catch is not supported yet.

BuildHive (Jenkins)

This software includes softwares developed by Apache Software Foundation.

You can’t perform that action at this time.