All Projects → louisdh → Lioness

louisdh / Lioness

Licence: mit
The Lioness Programming Language

Programming Languages

swift
15916 projects
bytecode
52 projects

Projects that are alternatives of or similar to Lioness

Cub
The Cub Programming Language
Stars: ✭ 198 (+27.74%)
Mutual labels:  compiler, ast, lexer, parser, interpreter, virtual-machine
Charly Vm
Fibers, Closures, C-Module System | NaN-boxing, bytecode-VM written in C++
Stars: ✭ 66 (-57.42%)
Mutual labels:  compiler, ast, lexer, parser
Tiny Compiler
A tiny compiler for a language featuring LL(2) with Lexer, Parser, ASM-like codegen and VM. Complex enough to give you a flavour of how the "real" thing works whilst not being a mere toy example
Stars: ✭ 425 (+174.19%)
Mutual labels:  compiler, ast, lexer, parser
Snapdragon
snapdragon is an extremely pluggable, powerful and easy-to-use parser-renderer factory.
Stars: ✭ 180 (+16.13%)
Mutual labels:  compiler, ast, lexer, parser
Webassemblyjs
Toolchain for WebAssembly
Stars: ✭ 566 (+265.16%)
Mutual labels:  compiler, ast, parser, interpreter
Exprtk
C++ Mathematical Expression Parsing And Evaluation Library
Stars: ✭ 301 (+94.19%)
Mutual labels:  compiler, ast, lexer, parser
Phplrt
PHP Language Recognition Tool
Stars: ✭ 127 (-18.06%)
Mutual labels:  compiler, ast, parser
Php Parser
🌿 NodeJS PHP Parser - extract AST or tokens (PHP5 and PHP7)
Stars: ✭ 400 (+158.06%)
Mutual labels:  ast, lexer, parser
Ph7
An Embedded Implementation of PHP (C Library)
Stars: ✭ 422 (+172.26%)
Mutual labels:  compiler, interpreter, virtual-machine
Tiny Compiler
A tiny evaluator and compiler of arithmetic expressions.
Stars: ✭ 680 (+338.71%)
Mutual labels:  compiler, ast, interpreter
Umka Lang
Umka: a statically typed embeddable scripting language
Stars: ✭ 308 (+98.71%)
Mutual labels:  compiler, interpreter, virtual-machine
Minigo
minigo🐥is a small Go compiler made from scratch. It can compile itself.
Stars: ✭ 456 (+194.19%)
Mutual labels:  compiler, lexer, parser
Mico
Mico ("Monkey" in catalan). Monkey language implementation done with C++. https://interpreterbook.com/
Stars: ✭ 19 (-87.74%)
Mutual labels:  lexer, parser, interpreter
Ratel Core
High performance JavaScript to JavaScript compiler with a Rust core
Stars: ✭ 367 (+136.77%)
Mutual labels:  compiler, ast, parser
V8
The official mirror of the V8 Git repository
Stars: ✭ 18,808 (+12034.19%)
Mutual labels:  compiler, interpreter, virtual-machine
Craftinginterpreters
Repository for the book "Crafting Interpreters"
Stars: ✭ 4,298 (+2672.9%)
Mutual labels:  compiler, parser, interpreter
Csstree
A tool set for CSS including fast detailed parser, walker, generator and lexer based on W3C specs and browser implementations
Stars: ✭ 1,121 (+623.23%)
Mutual labels:  ast, lexer, parser
Rs Monkey Lang
Monkey Programming Language written in Rust.
Stars: ✭ 80 (-48.39%)
Mutual labels:  lexer, parser, interpreter
Swiftpascalinterpreter
Simple Swift interpreter for the Pascal language inspired by the Let’s Build A Simple Interpreter article series.
Stars: ✭ 270 (+74.19%)
Mutual labels:  ast, lexer, interpreter
Quickjs
The official repo is at bellard/quickjs.
Stars: ✭ 1,429 (+821.94%)
Mutual labels:  compiler, interpreter, virtual-machine

Lioness CubSavannaKit

Lioness Logo

The Lioness Programming Language

Travis build status Codecov
version 0.5.2 Carthage Compatible Swift Platform: iOS macOS tvOS watchOS Extension: .lion
Twitter Donate via PayPal

Lioness is a high-level, dynamic, programming language designed for mathematical purposes. This project includes a lexer, parser, compiler and interpreter. All of these are 100% written in Swift without dependencies.

The syntax of Lioness is inspired by Swift, and its feature set is akin to shader languages such as GLSL.

The standard library (abbreviated: stdlib) contains basic functions for number manipulation, including: max/min, ceil, floor, trigonometry, etc. However, more trivial functions, such as to calculate prime numbers, are not considered relevant for the standard library.

Source examples

The following Lioness code calculates factorials recursively:

func factorial(x) returns {
	
    if x > 1 {
        return x * factorial(x - 1)
    }
	
    return 1
}

a = factorial(5) // a = 120

The following Lioness code uses a do times loop:

a = 1
n = 10
do n times {
    a += a
}
// a = 1024

More examples can be found here.

Features

  • Minimalistic, yet expressive, syntax
  • No type system, language is dynamic
  • 5 basic operators: +, -, /, * and ^
    • ^ means "to the power of", e.g. 2^10 equals 1024
    • all operators have a shorthand, e.g. += for +
  • Numbers
    • All numbers are floating point
  • Booleans
    • Can be evaluated from comparison
    • Can be defined by literal: true or false
  • Functions
    • Supports parameters, returning and recursion
    • Can be declared inside other functions
  • Structs
    • Can contain any type, including other structs
  • Loops
    • for
    • while
    • do times
    • repeat while
    • break
    • continue
  • if / else / else if statements

Running

Since the project does not rely on any dependencies, running it requires no setup.

macOS

Open Lioness.xcworkspace (preferably in the latest non-beta version of Xcode) and run the macOS Example target. The example will run the code in A.lion. The output will be printed to the console.

Installing framework

Using Swift Package Manager

Add to your Package.swift file's dependencies section:

.Package(url: "https://github.com/louisdh/lioness.git",
		         majorVersion: 0, minor: 5)

Using CocoaPods

Add the following line to your Podfile:

pod 'Lioness', '~> 0.5'

Using Carthage

Add the following line to your Cartfile:

github "louisdh/lioness" ~> 0.5

Run carthage update to build the framework and drag the built Lioness.framework into your Xcode project.

Standard Library

Please note: Lioness is currently in beta

The Standard Library is currently under active development. There currently is no one document with everything from the stdlib. The best place to look for what's available is in the source files.

Roadmap

  • [x] Structs
  • [ ] Completion suggestions (given an incomplete source string and insertion point)
  • [ ] Breakpoint support in interpreter
  • [ ] Stdlib documentation (Dash?)
  • [ ] Compiler warnings
  • [ ] Compiler optimizations
  • [x] Faster Lexer (without regex)
  • [x] Support emoticons for identifier names
  • [ ] guard statement
  • [ ] A lot more unit tests
  • [x] Linux support

Xcode file template

Lioness source files can easily be created with Xcode, see XcodeTemplate.md for instructions.

Architecture

A detailed explanation of the project's architecture can be found here.

License

This project is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].