GithubHelp home page GithubHelp logo

wafelack / orion Goto Github PK

View Code? Open in Web Editor NEW
238.0 4.0 10.0 2.15 MB

Orion is a high level, purely functional programming language with a LISP based syntax.

License: GNU General Public License v3.0

Rust 91.99% Python 1.12% Clojure 6.90%
language orion programming-language lisp

orion's Introduction

Orion


Orion is a high level, purely functional programming language with a LISP based syntax.

GitHub Repo stars Continuous Build Continuous Test GitHub forks


Features

  • Lightness: Orion source code fits under 3k SLOC and its binary is under 2MB.
  • Portable: Orion code is run on a virtual machine, that avoids architecture-specific problems.
  • Purely functional: Pattern matching, immutability, side effects control.
  • Elegant: It embeds shorthands such as '<expr> for (\ () <expr>), [x y z] for (Cons x (Cons y (Cons z Nil))) or { <expr>* } for (begin <expr>*).

Installation

You will need: the Rust toolchain (1.50+), a "make" program, a POSIX shell (linked in /bin/sh) and Git.

$ git clone https://github.com/orion-lang/orion.git
$ cd orion/
$ chmod +x configure
$ ./configure
$ make
$ make install PREFIX=/wherever/you/want/

Documentation

You can find a detailed tutorial, the standard library, the core and the builtins documentation here.

Quick Example

Factorial function:

(def factorial (λ (n)
    (match n
    (0 1)
    (_ (* n (factorial (- n 1)))))))

Performance Tests

ack 3 3

Language Average Median Amplitude
Nixt 126ms 121ms 134ms
Orion Interpreter 76.106ms 75ms 21ms
Orion VM 4.168ms 4ms 4ms
CPython 0.516ms 0.482ms 0.541ms

Acknowledgments

Special thanks to @Mesabloo and @felko for support and help about implementation details.

License

This software and all associated items (assets, documentation, etc) are licensed under the GNU General Public License version 3.0 and higher.

orion's People

Contributors

kreyren avatar wafelack 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  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  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  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

orion's Issues

Bytecode deserializer

The bytecode deserializer (src/bytecode.rs) should be fixed, it fails on matches deserialization.

Webassembly Support

Currently orion does not compile on the wasm32-unknown-unknown target because of a few function calls in fs2.

It would be nice to have a default feature that enables IO functionality so this project can be used from wasm.

Self-contained documentation and maybe namespacing

Hello @Wafelack,
This is an interesting language written in my favorite language. I have some discussion regarding the roadmap.

What do you think about including a documentation inside the binding?
It is interesting on how bindings are separated from the value, even from the function at all times. But, I'm curious if–like other lisp–we can put the documentation into the binding, especially the standard library. We can then inspect it in the REPL and that will enable best practice enforced when making libraries.

Do you plan to have namespace? Or even module? More roadmap?
Curiously, I imagine this toy language (despite already good) will scale one day. I'm interested to see some namespace or module system. Well, currently I'm learning the source, but I'd like to hear the roadmap or plan that you may have devised.

Efficiency?

I would love to use this for scripting of downstream items on my package manager.

@Wafelack Will you handle the efficiency so that it's not so slow?

Recursive macro support

Adding recursive macro support could transform Orion in a powerful language because :

Recursive macros woudln't be dependent on callstack because they would be translated directly in parsing step. I already see a way of implementing that : Tail call optimisation system.

Recursive macros would just transform some recursive code into simple iterative code.

(macro factorial (x) {
  (if (= x 0) (return 1))
  (return (* x (factorial (- x 1))))
})

Regards,
Thomas.

String functions

Add functions for string mainuplation in the builtins and in the standard library.
Here a non exhaustive list:

  • strlen
  • @
  • substr
  • strcat
  • split
  • replace
    Of course do not forget to add documentation for every function.

Authorize double imports

Currently, this kind of codes does not work:

(load "core/math.orn")
(load "core/bool.orn")

because math.orn imports bool.orn.

It may be good to have an "import checker" to check if it has already been imported, and if yes, skip the load call.

A prelude

It could be good to automatically import useful files on interpreter startup, like core/*.orn, std/list.orn, std/maybe.orn, etc.

Token Comments and documentation

While reading the documentation, I didn't find the comment syntax.

Orion doesn't have token comment syntax from R7RS. It's useful to comment a block like ;#(abc def).
It's also useful as REPL prompt too.

For example, the (mock) REPL output below can be used directly.

#;orion:001> 1
; => 1

Common Lisp like `restart`s

A restart interface would be great, e.g.,

(defun apply (f x)
  (if (not (eq? (type-of f) 'function))
    (restart "Not a function"
                 '(("Abort" . 'nil)
                   ("Supply another function" . `(apply (eval (read)) ,x))))
    (f x)))

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.