Skip to content

Element is an embeddable minimal functional programming language intended as a data format.

License

Notifications You must be signed in to change notification settings

Esvandiary/Element

 
 

Repository files navigation

Element

Element is a minimal functional programming language. Element code runs using a host which can interpret or compile it to other formats. One of these formats is the bytecode format, LMNTIL (Element Intermediate Language), for use in native and embedded applications.

Overhaul

Content in this repository is currently undergoing large-scale overhaul. Most content conforms to older undocumented conventions or is broken.

  • Language Reference Manual - Updated
  • Prelude - Updated (untested, no compiler has been updated yet)
  • Laboratory (Test Suite) - In progress
  • Almost everything else - Working using undocumented previous language version or broken

Element Language

This is a brief summary, see the Element Reference Manual for full details.

  • Single number data type num
  • Structured types using struct
  • First class functions and local functions
  • Intrinsics (math intrinsics, collection intrinsics, control flow)
  • Genericity via implicit interfaces with any type

Element Libraries

Element includes a library of core functionality called Prelude.

Element also comes with a Standard Library. New features will generally be implemented as part of the standard library rather than as language features.

Repository Layout

  • Laboratory - The Element Host Test Suite - .NET Core 2.1 CLI
    • Test runner using NUnit containing host compliance tests, prelude tests and standard library tests.
    • Can test Element.NET directly or invoke other compilers via CLI convention

Host Libraries

  • Element.NET - .NET Standard 2.0
    • Element parser using Eto.Parse
    • Element function evaluation via:
      • Direct evaluation (slow)
      • Compilation to CLR Function using LINQ Expressions (very fast)
    • AoT compilation targets including:
  • libelement - C++
    • Element parser
    • Element function evaluation
    • AoT compilation to:
  • PyElement - Python
    • Element parser using TatSu
    • Element interpreter using Python eval()
  • LMNT - C
    • LMNTIL interpreter
    • JIT compiler using DynASM
      • x86_64
      • ARMv7-M - in progress
      • ARMv7-A - planned

Command Line Interfaces (CLIs)

  • Alchemist - .NET Core 2.1 using Element.NET
    • CLI for executing Element via a REPL or compiling to other targets

Integrations/Tooling

  • Element.Unity - Unity using Element.NET
    • Node Graph - allows visualization and modification of Element code using an interactive Node Graph
    • Debugger - allows evaluating arbitrary Element code and exploring all of the intermediates in a foldout tree
    • Interactive Workspace - allows evaluating arbitrary Element code and displaying immediate intermediates and visualization (Likely to be merged with Debugger in future)
  • VSCode Linter - VSCode Extension
    • Syntax highlighting for .ele files
    • Installation guide:
      • Download or clone this repo
      • Extract element-vscode to %UserProfile/.vscode/extensions
      • Restart VS Code and enjoy!

About

Element is an embeddable minimal functional programming language intended as a data format.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 34.5%
  • C# 33.1%
  • C 28.8%
  • Python 2.2%
  • CMake 1.2%
  • Objective-C 0.2%