{"id":13782040,"url":"https://github.com/phreppo/pilisp","last_synced_at":"2025-10-04T19:55:05.367Z","repository":{"id":46144912,"uuid":"132271225","full_name":"phreppo/pilisp","owner":"phreppo","description":"Lisp interpreter with bytecode compiler","archived":false,"fork":false,"pushed_at":"2021-01-07T16:37:06.000Z","size":8238,"stargazers_count":30,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-19T16:22:11.676Z","etag":null,"topics":["c","interpreter","lisp"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phreppo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-05T17:46:44.000Z","updated_at":"2025-07-09T11:58:43.000Z","dependencies_parsed_at":"2022-08-02T18:30:30.459Z","dependency_job_id":null,"html_url":"https://github.com/phreppo/pilisp","commit_stats":null,"previous_names":["phreppo/pilisp","parof/pilisp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/phreppo/pilisp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phreppo%2Fpilisp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phreppo%2Fpilisp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phreppo%2Fpilisp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phreppo%2Fpilisp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phreppo","download_url":"https://codeload.github.com/phreppo/pilisp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phreppo%2Fpilisp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278366633,"owners_count":25975090,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","interpreter","lisp"],"created_at":"2024-08-03T18:01:32.219Z","updated_at":"2025-10-04T19:55:05.347Z","avatar_url":"https://github.com/phreppo.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# pilisp #\n\n[![Build Status](https://travis-ci.com/parof/pilisp.svg?token=tdfVkJVdJvEzUpskJRQE\u0026branch=master)](https://travis-ci.com/parof/pilisp) [![codecov](https://codecov.io/gh/parof/pilisp/branch/master/graph/badge.svg)](https://codecov.io/gh/parof/pilisp) [![Github Pages docs](https://img.shields.io/badge/docs-ghpages-blue.svg)](https://parof.github.io/pilisp/)\n\n* [Introduction](#introduction)\n* [Language](#language)\n* [Documentation](#documentation)\n* [Installation](#installation)\n\n## Introduction ##\n\nPilisp aims to be a small LISP interpreter for the 1.5 version of the language described [here](http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf).\n\n### Features ###\n\n* **Lambdas**: (lambda ({args}) {body}) syntax allowed\n* **Garbage Collector**: mark and sweep garbage collector\n* **Bytecode virtual machine interpreter**: some simple lambdas can be compiled to a bytecode faster version\n* **Memory dump builtin**: (md) prints the structure of the allocated memory\n\n### Performance ###\n\nThese are the performances compared to other Lisp interpreters: [CLisp](https://clisp.sourceforge.io/), Yoctolisp (similar performances to [Femtolisp](https://github.com/JeffBezanson/femtolisp)) and [SBCL](http://www.sbcl.org/).\n\n\n![alt text](img/performances.png \"Logo Title Text 1\")\n\n\n## Language ##\n\nThe language accepted by the interpreter is inspired to the [Common Lisp](https://en.wikipedia.org/wiki/Common_Lisp), but keeps the _homoiconicity_ feature of the original definition of the LISP 1.5: data and instructions are kept together in the same data structure, the _cons cell_.\n\n### Builtin functions ###\n\n* Lisp basic functions\n    * car\n    * cdr\n    * cons \n    * atom\n    * eq\n    * quote\n    * cond\n* Arithmetic\n    * \\+\n    * \\-\n    * \\*\n    * \\/\n* Logic\n    * or\n    * and \n    * not\n* Comparison\n    * \\\u003e\n    * \\\u003e=\n    * \\\u003c\n    * \\\u003c=\n    * integerp\n    * symbolp\n* Lists operations\n    * list\n    * reverse\n    * member \n    * nth\n    * concatenate\n    * append\n    * length\n    * subseq\n* Common Lisp inherited functions\n    * set\n    * write\n    * load\n    * bye\n* Macros\n    * setq\n    * defun\n    * let\n    * dotimes\n    * map\n    * time\n    * defmacro\n* Pilisp special functions\n    * md: prints the memory\n    * env: prints the global env\n    * cg: calls the garbage collector\n\n### Bytecode instruction set ###\n\nYou can optionally produce one mid-representation for some expression. The bytecode will run faster than normal LISP code. \nTo achieve this goal Pilisp interpreter adds these instructions to the language: \n\n* **plc**: PiLisp Compiler. Called on one sexpression tries to produce the corresponding bytecode of one quoted expression.\n    \n    ```\n    (plc '(car '(a))) =\u003e (ASM \"!$B\" (A) CAR)\n    ```\n\n* **asm**: c-like notation for assembly. This instruction can be interpreted. The first arg is the machine code. Refer [here](#instructionset) for the list of codes. The other arguments are the parameters.\n\n    ```\n    (ASM \"!$B\" (A) CAR)\n    ```\n    has to be read as: `load a const -\u003e that const is (A) -\u003e apply a builtin function -\u003e That function is car -\u003e That function has 1 parameter -\u003e Put the result on the top of the stack` . The result of a computation is always the top of the stack.\n\n* **lasm**: lambda-asm. Represents a asm computation that accepts input parameters: it is a compiled lambda. The first parameter represents the number of parameters. The rest of the parameters are the same as asm.\n\n    ```\n    ((LASM 1 \"@A!$C\" 1 +) 2)\n    ```\n    The last is an example of the 1+ function compiled and  applied to the number 2\n\n* **compile**: tries to compile one function. If this is possible the new definition will be substituted to the old one.\n\n    ```\n    (defun id (x) x)\n    (compile id)\n    ```\n    will produce a new and faster identity function.\n    \n\n#### Instruction set ####\n| Code        | Meaning         |\n| :---:       | :---:           |\n| !           | load constant   |\n| ?           | load symbol     |\n| @           | load name from stack     |\n| $           | apply builtin lambda      |\n| \\[A-Z\\]     | numbers from 0 to 25     |\n\n\n## Documentation ##\n\nFull code documentation can be found on [github pages](https://parof.github.io/pilisp/). It is automatically generated using [Doxygen](http://www.stack.nl/~dimitri/doxygen/), with [Bootstrap](https://getbootstrap.com/) CSS (using [this](https://github.com/Velron/doxygen-bootstrapped) guide). The code documentation is generated every push with [Travis CI](https://travis-ci.org/), so it should be always up to date.\n\n## Installation ##\n\n### Prerequisites ###\n\n* [Meson](http://mesonbuild.com/)   (version 0.44 or newer)\n* [Python](https://www.python.org/) (version 3.5 or newer)\n* [Ninja](https://ninja-build.org/) (version 1.5 or newer)\n\n### Installing with Meson ###\n\nThese commands should run on any OS. To build the `ninja.build` file run. The `-Dc_args` will add optimizations.\n\n```\nmeson build -Dc_args=-Og\n```\n\nTo build the executable in the `build` directory run\n\n```\nninja -C build\n```\n\nTo install `pilisp` run with root permissions\n\n```\nninja install -C build\n```\n\nTo run tests use\n\n```\nninja test -C build\n```\n\nBy default Meson won't allow debugging: if you want to run a debbuger you have to write:\n```\nmeson build -Db_coverage=true\n```\n\nRun with Valngrid:\n```\nmeson test --wrap=valgrind 'testname'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphreppo%2Fpilisp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphreppo%2Fpilisp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphreppo%2Fpilisp/lists"}