Skip to content
/ elma Public

An experimental hobby compiler and type system

Notifications You must be signed in to change notification settings

mogemimi/elma

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Elma

Elma is an experimental, hobbyist and toy compiler that is being developed primarily as a learning project, research code and for fun. It is also open source and distributed under the MIT License. Feel free to fork, submit a pull request or modify anywhere you like!

Language Specification

func greeting(s: String) -> String {
    return "Hello, " + s;
}

print(greeting("world"));

Requirements

Elma is written in C++17 and designed for multi-platform. To build and test, the following packages are required:

  • CMake 3.10 and later
  • Visual Studio 2017 and later (for Windows)
  • Xcode 9.2 and later (for macOS)
  • Clang (for Linux)

Optional:

  • Bison 3.0.4
  • Flex 2.6.4
  • ClangFormat 6.0.0 or later

Building

To build the project with CMake, run the following from the root directory:

cd path/to/elma

# Building library and test cases
cmake -Bbuild -H. && make -C build

# Running test application
./build/unittest

To generate Xcode project, execute the following command:

cd path/to/elma

# Generating Xcode projects
mkdir build && cd build
cmake -G Xcode ..

# Opening your project
open elma.xcodeproj

# Building with Xcode
xcodebuild -project elma.xcodeproj -configuration Release

# Running test application
./Release/unittest

Generating Lexer and Parser

To generate lexer and parser, use the following command:

# Generating lexer using Flex
flex src/Parser/Lexer.l

# Generating parser using Bison
bison src/Parser/Parser.y

Open Source Software used in Elma

All of the dependencies that Elma needs to build or run.

To update all third party libraries, execute the following command:

cd path/to/elma

# Updating Catch2
curl -L https://github.com/catchorg/Catch2/releases/download/v2.2.2/catch.hpp -o thirdparty/catch2/catch.hpp

# Updating Duktape
curl -O -L https://github.com/svaarala/duktape/releases/download/v2.2.1/duktape-2.2.1.tar.xz
tar xpvf duktape-2.2.1.tar.xz
cp -R duktape-2.2.1/src/ thirdparty/duktape
rm duktape-2.2.1.tar.xz
rm -R duktape-2.2.1

About

An experimental hobby compiler and type system

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published