Code Monkey home page Code Monkey logo

ola's Introduction

Ola

Ola is a toy object-oriented programming language with LLVM backend.

Dependencies

Features

  • classes
    • access modifiers: public, private
    • constructors
    • single inheritance: :
    • polymorphism using vtables: virtual, pure, final
    • this and super keywords
  • reference type: ref
  • automatic type deduction: auto
  • operators:
    • additive: +, -, +=, -=, ++, --
    • multiplicative: *, /, %, *=, /=, %=
    • relation: ==, !=, >, >=, <, <=
    • shift: >>, <<, >>=, <<=
    • bitwise: &, |, ^, ~, &=, |=, ^=
    • logic: &&, ||, !
  • 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++'s extern "C")
  • arrays
  • sizeof, length operators
  • alias
  • strings
  • floats
  • implicit casts
  • scopes
  • import statement
  • standard library

Todo

  • Custom backend
    • windows x86-64 (wip)

Structure

Ola consists of three parts:

  1. 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.
  2. 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.
  3. Ola tests
    • UnitTest framework for testing existing Ola features. Uses GoogleTest.

Usage

Command line options

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

Samples

Currently to see the samples you can check the test folder: OlaTests/Tests/.

ola's People

Contributors

mateeeeeee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.