A 3-line lisp implementation

Related tags

Miscellaneousnanolisp
Overview

Nanolisp

The download page of many a language harbors deep senses of forboding, of evil lurking in its native lair. You feel that the language is not a friend, that it means to harm you. You wonder what will happen when you click on the download link.

But don't be scared. Nanolisp is a friend in a desert of programming languages. It can fit in a clipboard or an email. A file or a project. Just 3 lines of code long, it really has earned its name. It only relies on standard, cross-platform modules. It is an oasis for many a person.

Installation

Copy and paste. Et viola! You have a complete nanolisp download! Python 3.8 or greater is needed to run the code. But I promise you, it will be worth it.

The examples following this one will assume you have copy-pasted it into a file called nl.py.

Basic Usage

Run python3 nl.py to open up the REPL. There, you can do many operations. Here is a sample session:

$ python3 nl.py
Welcome to Nanolisp 1.0.1!
> (+ 1 1)
2
> (define a 5)
> a
5
> (+ a 5)
10
> (define (inc n)
    (+ n 1))
> (inc 4)
5
> (exit)
$

As you can see, Nanolisp offers a full-featured repl. To run from a file is similarly simple: python3 nl.py . In fact, this repository includes a test file, titled schemetest.scm, which implements an algorithm for square root and runs it on 10 (the algorithm itself was taken from the seminal textbook on Scheme, Structure and Interpretation of Computer Programs).

Advanced Usage

Although I made this for fun, I quickly realized that this could be applied to config files and similar goals. This leads to the fairly large topic of a Domain Specific Language (DSL). Nanolisp is designed to be extensible and easily so. Unfortunately, due to its complex implementation, it's not extensible in all of its aspects.

To be continued...

API

Z (Environment)

Z is the variable used to store the environment. It has a custom type, but it was based off of Peter Norvig's implementation of the environment in lis.py. Why is it called Z? I have no idea.

ev (evaluate)

Evaluate an AST (tuple of tuples).

run

Run a string.

rf (run file)

Open a file and run it (leaks memory, I guess)

repl

Start the actual REPL, as opposed to the banner.

parsers

The name is pretty misleading; this is a list of transformations applied to the lisp code to turn it into valid python code. Feel free to add elements to it if you know what you're doing.

initl (init loader)

Allows you to import scheme files.

Owner
A 9th grader who's interested in coding, math, or really anything.
GA SEI Unit 4 project backend for Bloom.

Grow Your OpportunitiesTM Background Watch the Bloom Intro Video At Bloom, we believe every job seeker deserves an opportunity to find meaningful work

Jonathan Herman 3 Sep 20, 2021
Registro Online (100% Python-Mysql)

Registro elettronico scritto in python, utilizzando database Mysql e Collegando Registro elettronico scritto in PHP

Sergiy Grimoldi 1 Dec 20, 2021
Delayed iteration for polling and retries.

Does Python need yet another retry / poll library? It needs at least one that isn't coupled to decorators and functions. Decorators prevent the caller

A. Coady 22 Dec 29, 2022
sawa (ꦱꦮ) is an open source programming language, an interpreter to be precise, where you can write python code using javanese character.

ꦱꦮ sawa (ꦱꦮ) is an open source programming language, an interpreter to be precise, where you can write python code using javanese character. sawa iku

Rony Lantip 307 Jan 07, 2023
x-tools is a collection of tools developed in Python

x-tools X-tools is a collection of tools developed in Python Commands\

5 Jan 24, 2022
A bot to use in a pump & dump event

A bot to use in a pump & dump event on Binance.com. Please note the bot is in heavy devleopment currently so be aware of errors. If you experience err

Freddie Jonas 189 Dec 24, 2022
Blender addon to import images as meshes

ImagesAsMesh Blender addon to import images as meshes. Inspired by: ImagesAsPlanes Installation It's like just about every other Blender addon. Downlo

Niccolo Zuppichini 4 Jan 04, 2022
Data Poisoning based on Adversarial Attacks using Non-Robust Features

Data Poisoning based on Adversarial Attacks using Non-Robust Features Usage python main.py [-h] [--gpu | -g GPU] [--eps |-e EPSILON] [--pert | -p PER

Jonathan E. 1 Nov 02, 2021
Python most simple|stupid programming language (MSPL)

Most Simple|Stupid Programming language. (MSPL) Stack - Based programming language "written in Python" Features: Interpretate code (Run). Generate gra

Kirill Zhosul 14 Nov 03, 2022
Odoo modules related to website/webshop

Website Apps related to Odoo it's website/webshop features: webshop_public_prices: allow configuring to hide or show product prices and add to cart bu

Yenthe Van Ginneken 9 Nov 04, 2022
Packages of Example Data for The Effect

causaldata This repository will contain R, Stata, and Python packages, all called causaldata, which contain data sets that can be used to implement th

103 Dec 24, 2022
Junos PyEZ is a Python library to remotely manage/automate Junos devices.

The repo is under active development. If you take a clone, you are getting the latest, and perhaps not entirely stable code. DOCUMENTATION Official Do

Juniper Networks 623 Dec 10, 2022
Programming in Bioinformatics, Block 3

Programming in Bioinformatics - Block 3 I. Setting up Environment and Running the Code Create the environment using the pibi_block3.yml file with the

2 Dec 10, 2021
Scripts to integrate DFIR-IRIS, MISP and TimeSketch

Scripts to integrate DFIR-IRIS, MISP and TimeSketch

Koen Van Impe 20 Dec 16, 2022
Pre-1.0 door/chest sound injector for Minecraft

doorjector Pre-1.0 door/chest sound injector for Minecraft. While the game is running, doorjector hotswaps the new sounds for the old right before the

Sam 1 Nov 20, 2021
Excel cell checker with python

excel-cell-checker Description This tool checks a given .xlsx file has the struc

Paul Aumann 1 Jan 04, 2022
A small project of two newbies, who wanted to learn something about Python language programming, via fun way.

HaveFun A small project of two newbies, who wanted to learn something about Python language programming, via fun way. What's this project about? Well.

Patryk Sobczak 2 Nov 24, 2021
Hands-on machine learning workshop

emb-ntua-workshop This workshop discusses introductory concepts of machine learning and data mining following a hands-on approach using popular tools

ISSEL Soft Eng Team 12 Oct 30, 2022
An Android app that runs Elm in a webview. And a Python script to build the app or install it on the device.

Requirements You need to have installed: the Android SDK Elm Python git Starting a project Clone this repo and cd into it: $ git clone https://github.

Benjamin Le Forestier 11 Mar 17, 2022
Ice Skating Simulator for Winter and Christmas [yay]

Ice Skating Simulator for Winter and Christmas [yay]

1 Aug 21, 2022