Giter Club home page Giter Club logo

raillisp's Introduction

// raillisp \\

Raillisp is a simple lisp implemented in Forth. It aims to be small, fast, and portable.

Raillisp is in active development. Currently it only runs on Gforth, but will soon run on everything from microcontrollers to web browsers.

It is designed to give you high level lisp features while retaining low level access and a small footprint making it suitable for constrained systems. Raillisp lets you ride the metal in style.

Raillisp works by compiling lisp functions into forth words. For example, creating a lisp function and disassembling its forth word:

  (defun fib (n)
    (if (< n 3)
        1
      (+ (fib (- n 1)) (fib (- n 2)))))

  (dis fib)

prints:

 : fib
   dup 7 <
   IF     3
   ELSE   dup 3 - fib over 5 - fib +
   THEN
   nip ;

(the number constants are different because of the lisp type tagging, dis just calls the forth word see)

More documentation is forthcoming. For now more example code can be found in raillisp.lsp and tests.lsp.

The Raillisp dialect is influenced by Common Lisp and Scheme, but there are substantial differences. Lots of common features are not currently supported, some never will be. Features that compromise the performance of the system will not be implemented.

Usage

To run a file: gforth raillisp.fth FILE.lsp

For the REPL: gforth raillisp.fth

Run tests: make test

Be careful...There is currently almost no error checking of any kind. When you do something wrong, the helpful error message is probably a backtrace.

The make option to build a gforth image does not currently work becuase heap pointers are compiled into the dictionary.

raillisp's People

Contributors

mschuldt 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

Watchers

 avatar  avatar  avatar

Forkers

bendlas

raillisp's Issues

compilation error when functions have no body

(defun f ())
(defun f ())
Compilation error
:: function 'f' left 0 items on the stack, expected 1
:: stack: nil

0 140174537559704 -----
1 140174537578008 defun
2 140174537571584 progn
3 140174537572560 progn
4 140174537560112 -----
5 140174537592824 eval
6 140174537629848 repl
7 140174537631216 init
8 140174537586232 then,
9 140174537035232 -----

setting an undeclared variable results in a crash

variables need to be 'declared' with var before set can be used to set their value. this error should not result in a crash. And is the distinction between var and set really necessary?

'$ make run
gforth raillisp.fth
// Raillisp 0.1 \\

> (set x 4)
(set x 4) 

in file included from *the terminal*:0:-94508583085903: 
in file included from *the terminal*:-1:1: 
raillisp.fth:1606:36: error: Invalid memory address
s" _noinit_" find-name 0= s" init" >>>call-lisp<<< drop
Backtrace:
raillisp.fth:1477:64:                    0 $7F390FD166F0 execute 
raillisp.fth:1477:64:                    1 $7F390FD166F0 execute 
raillisp.fth:1605:18:                    2 $7F390FD1F2F8 
raillisp.fth:1605:18:                    3 $7F390FD1F5F0 
raillisp.fth:1334:35:                    4 $7F390FD14638 execute 

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.