Skip to content

Thourum/zLisp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zLisp

1 zLisp

See docs or paper.pdf

1.1 Introduction

zLisp (Zealand LISP) is a turing complete lisp interpreted programming languged developed for Zealand as part of a final project assignment.

1.2 Getting started

As the project does not have any portable executable the user is required to compile the source code to run it.

It can be done by:

Visual Studio
Open the solution file and run
netcore cli
by running `dotnet run` inside the ConsoleRun folder

1.3 Using

There are two ways one can use zLisp

1.3.1 REPL

The easiest is to use it as a standalone REPL, a Read-Eval-Print-Loop, that launches a environment where you can execute your code and normal fashion.

1.3.1.1 Example

$ dotnet run

                   █████       █████  █████████  ███████████
                  ░░███       ░░███  ███░░░░░███░░███░░░░░███
      █████████    ░███        ░███ ░███    ░░░  ░███    ░███
     ░█░░░░███     ░███        ░███ ░░█████████  ░██████████
     ░   ███░      ░███        ░███  ░░░░░░░░███ ░███░░░░░░
       ███░   █    ░███      █ ░███  ███    ░███ ░███
      █████████    ███████████ █████░░█████████  █████
     ░░░░░░░░░    ░░░░░░░░░░░ ░░░░░  ░░░░░░░░░  ░░░░░

    Welcome to Zealand LISP, a crude lisp implementation done in C#
    By Samuel Asvanyi for a school project @ Zealand 2021

zLisp > (def x 123)
zLisp > (println x)
123
zLisp > (def x "hello World!")
zLisp > (println x)
hello World!
zLisp >

1.3.2 Library in C#

Second way is to use the library inside your C# code where you would like to expose a part of your program with out having to create a seperate API for your application. You can use the zLisp library and let the user provide you with the code where you can chose to expose certain functions to them.

using ZLisp.Runtime;

Runtime.Eval("(def not (fn (a) (if a false true)))"); // will define a not
function 
var results = Runtime.Eval("(not true)");
Console.WriteLine(results); // false

Runtime.Env.Set(new Symbol("is2"), new Func(a => ((Types.Integer)a[0]).Value == 2););
Console.WriteLine(Runtime.Eval("(is2 2)")); // true
Console.WriteLine(Runtime.Eval("(is2 4)")); // false

Releases

No releases published

Packages

No packages published

Languages