Skip to content
Ethereal Language Reference Implementation
C++ CMake Other
Branch: master
Clone or download
Electrux src_t field id is now an integer value which works in combination wit…
…h vm.srclist vector; the field id will always be unique for each source
Latest commit 22b3fe3 Nov 21, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Design quality of markdown changes Sep 2, 2019
book fixed some stuff in book Nov 19, 2019
ethereal-vscode added a doxygen configuration and doxydized(?) src/FE/Lexer.hpp; will… Sep 19, 2019
include/ethereal inlined imports in playground.et and build.et; fixed incorrect conten… Nov 18, 2019
modules src_t field id is now an integer value which works in combination wit… Nov 21, 2019
src src_t field id is now an integer value which works in combination wit… Nov 21, 2019
tests removed alias feature of import system; added support for grouping ( … Nov 18, 2019
tools/epm fixed memory leaks in modules/eth/vm.cpp; all internal functions (add… Nov 11, 2019
.cirrus.yml in cirrus yml: set bsd and mac nproc commands to sysctl -n hw.ncpu (f… Nov 11, 2019
.gitignore Ethereal no longer switches current directory to the current source's… Nov 11, 2019
CMakeLists.txt added build date in et -v information Nov 15, 2019
CONTRIBUTING.md Some updates to the core architecture Nov 11, 2019
Dockerfile changed make -j8 in Dockerfile to -j$(nproc) Nov 11, 2019
Doxyfile added a doxygen configuration and doxydized(?) src/FE/Lexer.hpp; will… Sep 19, 2019
LICENSE Added lexer code and parser's graphviz file with respect to keywords … Jun 4, 2019
README.md corrected build commands Nov 8, 2019
Samples.md additions to std.math + added std.runtime library Nov 13, 2019
build.et inlined imports in playground.et and build.et; fixed incorrect conten… Nov 18, 2019
perform_tests.et added basic result output when valgrind binary not found in perform_t… Nov 18, 2019
playground.et inlined imports in playground.et and build.et; fixed incorrect conten… Nov 18, 2019

README.md

Ethereal

Build Status

A simple, dynamically typed, interpreted, generic programming language.

Some Sample Programs

Hello world using Function:

fn hello( to ) {
	println( 'Hello ', to );
}

hello( 'world' );

Taking input from the user - with a prompt:

dat = scan( 'Please enter some data: ' );
println( 'The data you entered is: ', dat );

Iterative Factorial of a number:

import std.str; # for to_int()

num = scan( "Enter factorial of: " ).to_int();
fact = 1;

for x = num; x >= 2; x -= 1 {
        fact *= x;
}

println( "Factorial of ", num, ": ", fact );

About

Visit the medium article here, for an overview of my journey with Ethereal :)

The language syntax is inspired from Python and C. It contains sufficient features to enjoy working with it, but avoids complex features like OOP.

Ethereal does use a concept of member functions which are actually nothing but plain functions bound to a particular struct/type. And they allow the use of self to use the calling variable inside the function itself.

One can easily make extensions for the language in the form of language modules or c++ dynamic libraries (if high performance is needed). See the existing modules for more information about it (language modules: include/ethereal/, C++ standard modules: modules/std/).

Documentation is under development and will take some time to build, but till then, feel free to go through the Code Samples and hack around with the programs in the tests directory.

Prerequisites

  • GCC/Clang with full C++ 11 support, tested with:
    • Ubuntu >= 14.04 (GCC >= 4.8.4, GMP >= 5.1.3)
    • Arch Linux (GCC 9.1.0, GMP 6.1.2)
    • macOS 10.14.6 (Homebrew LLVM 8.0.1, Apple LLVM 10.0.1, Homebrew GMP 6.1.2)
    • FreeBSD 10.4 (clang 3.4.1, GMP 6.1.2)
    • Android 9 - Pie (Termux - clang 8.0.0, GMP 6.1.2 manually compiled - see the note below)
  • GMP library with CXX support (will be almost always built with support for CXX in your official distribution package)

Note that GMP on Termux for android does not come with CXX support, hence it will have to be manually compiled from source with the --enable-cxx configure option. You may also need to specify the PREFIX_DIR directory using --prefix configure option which, for me, is /data/data/com.termux/files/usr

The entire command sequence for installing GMP on android (for me) is: ./configure --prefix /data/data/com.termux/files/usr --enable-cxx && make -j8 && make install

Also, compiling with Link Time Optimization won't work on clang < 3.9, so disable LTO by setting SKIP_LTO=true before executing the bootstrap.sh script

Installation

Once the prerequisites are met, just execute the cmake script by doing mkdir build && cd build && cmake .. && make -j<cpu core count> commands. They will build the language interpreter along with the stdlib modules. Installation (using make install) should be done ONLY if the PREFIX_DIR variable is set to a directory other than the cmake build/ directory.

Note that if you use PREFIX_DIR, you may need root access depending on the directory you choose.

The following items will be installed:

  • buildfiles/et -> $PREFIX_DIR/bin/
  • buildfiles/lib*.so $PREFIX_DIR/lib/ethereal/
  • include/ethereal/* $PREFIX_DIR/include/ethereal/

Also, the interpreter code internally uses PREFIX_DIR to locate the lib and include directories, so you will have to rebuild the codebase if you change PREFIX_DIR.

Contributions are definitely accepted and greatly appreciated. ❤️

You can’t perform that action at this time.