Ola is a toy programming language with LLVM backend.
- LLVM 17.0.1 for compiler backend.
- spdlog for logging.
- CLI11 for command line parsing.
- classes
- access modifiers:
public
,private
- constructors
- single inheritance:
:
- polymorphism using vtables:
virtual
,pure
,final
this
andsuper
keywords
- access modifiers:
- reference type:
ref
- automatic type deduction:
auto
- operators:
- additive:
+
,-
,+=
,-=
,++
,--
- multiplicative:
*
,/
,%
,*=
,/=
,%=
- relation:
==
,!=
,>
,>=
,<
,<=
- shift:
>>
,<<
,>>=
,<<=
- bitwise:
&
,|
,^
,~
,&=
,|=
,^=
- logic:
&&
,||
,!
- additive:
- control statements:
if
else
,switch
,goto
,?:
- loop statements:
for
,foreach
,while
,do
while
,break
,continue
- enums
- functions
- overloading
- attributes:
inline
,noinline
,nomangling
(equivalent to C++'sextern "C"
)
- arrays
sizeof
,length
operatorsalias
- strings
- floats
- implicit casts
- scopes
- import statement
- standard library
- Custom backend
- Custom IR and MIR
- x86-64 code generation
- todo:
- references
- classes
- stack layout
- IR optimization passes
Ola consists of three parts:
- Ola library - standard library for Ola language implemented in C and built as static library to be used by the compiler. Currently it contains 5 files: olaio.h, olamath.h, olaassert.h, olastring.h, olamemory.h.
- Ola compiler - consists of the following parts:
- Lexer - turns source file into a sequence of tokens
- Import Processor - receives tokens from previous phase and processes import statements.
- Parser - recursive descent parser that receives processed tokens and constructs Abstract Syntax Tree (AST) of a translation unit.
- Sema - does semantic analysis of a translation unit.
- LLVM Visitor - traverses AST and emits LLVM IR.
- LLVM Optimizer - applies optimizations to the generated LLVM IR produced by LLVM Visitor based on the optimization level used.
- Ola tests
- UnitTest framework for testing existing Ola features. Uses GoogleTest.
- -h,--help: Print this help message and exit
- --astdump: Dump AST to output/log
- --testdebug: Print debug information during tests
- --test : used for running g-tests
- --Od : No optimizations
- --O0 : Same as --Od
- --O1 : Optimize
- --O2 : Optimize more
- --O3 : Optimize even more
- -i ... : Input files
- -o : Output file
- --directory : Directory of project files
- --simple : input code in the form of a string
Currently to see the samples you can check the test folder: OlaTests/Tests/.