{"id":14980879,"url":"https://github.com/brentseidel/ada-lisp","last_synced_at":"2025-10-29T03:31:20.138Z","repository":{"id":95368063,"uuid":"225233864","full_name":"BrentSeidel/Ada-Lisp","owner":"BrentSeidel","description":"Tiny Lisp Interpreter Written in Ada","archived":false,"fork":false,"pushed_at":"2024-08-12T17:06:06.000Z","size":9430,"stargazers_count":26,"open_issues_count":1,"forks_count":1,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-10-11T21:41:30.391Z","etag":null,"topics":["ada","latex-document","lisp","lisp-dialect","lisp-interpreter"],"latest_commit_sha":null,"homepage":"","language":"Ada","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BrentSeidel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-01T21:30:55.000Z","updated_at":"2024-08-12T17:06:10.000Z","dependencies_parsed_at":"2023-12-28T03:10:37.348Z","dependency_job_id":"48236292-cf2f-4386-bde7-80fcbb3b91dd","html_url":"https://github.com/BrentSeidel/Ada-Lisp","commit_stats":{"total_commits":272,"total_committers":2,"mean_commits":136.0,"dds":"0.014705882352941124","last_synced_commit":"9f5f0c378868994a2de3ab757681c2a880b9ed8d"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrentSeidel%2FAda-Lisp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrentSeidel%2FAda-Lisp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrentSeidel%2FAda-Lisp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrentSeidel%2FAda-Lisp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BrentSeidel","download_url":"https://codeload.github.com/BrentSeidel/Ada-Lisp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219858508,"owners_count":16556043,"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","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":["ada","latex-document","lisp","lisp-dialect","lisp-interpreter"],"created_at":"2024-09-24T14:02:32.368Z","updated_at":"2025-10-29T03:31:14.663Z","avatar_url":"https://github.com/BrentSeidel.png","language":"Ada","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ada-Lisp\nThis is a tiny Lisp interpreter written in Ada.  As such, it lacks many of the features of\na full Common Lisp, but can provide a simple Lisp-like programming environment.\n\nIf you find it useful or interesting, drop me a note at brentseidel@gmail.com and\nlet me know.\n\nNote that this is my first attempt at writing a programming language, so I'm sure\nthat things could have been done better.  It has been a learning experience and\nI'm pleased with how well that it's actually turned out.\n\n\n[![Alire](https://img.shields.io/endpoint?url=https://alire.ada.dev/badges/bbs_lisp.json)]\n(https://alire.ada.dev/crates/bbs_lisp.html)\n\n\n[![Alire](https://img.shields.io/endpoint?url=https://alire.ada.dev/badges/lispcli.json)]\n(https://alire.ada.dev/crates/lispcli.html)\n\n\n## Dependencies and Building\nThis is available using alire (alr get bbs_lisp).  This will handle all\nof the dependencies.  Alire is available from https://alire.ada.dev.\n\nIf you do not with to use alire, you will need to fetch https://github.com/BrentSeidel/BBS-Ada.\n\n## Interpreter/Compiler\nI am calling this an interpreter, though the boundaries are a bit fuzzy.  The input text is\nconverted into s-expressions that represent the program.  The address for the builtin\noperations are stored in the s-expression and are then directly called when evaluated.\nIt may be considered to be a threaded interpreter (which as nothing to do with programming\nthreads as a method of concurrent programming).\n\n## Goals\nWhile under initial development, this runs on a host computer (MacOs, in my case), the\ngoal (achieved) is to get it to run on ARM based embedded systems.  Many of these little\nARM based boards have more computing power than the personal computers that I grew up\nwith and it seemed like a good idea to provide some sort of interpreter that could be\nused to write simple programs directly on the board.  I did briefly toy with the idea\nof a tiny BASIC interpreter, but quickly abandoned that idea in favor of Lisp.\n\nThe idea is that not only can simple programs be written, but it can also be used to\ndevelop algorithms for accessing the board's hardware.  Once the algorithm development is\nfinished, they can be translated into Ada and compiled.\n\n## Status\n\nWhile the only guarentee is that this contains bugs and is missing features, it\nis usable.  I've been able to write some small programs in it both on the Mac and\non the Arduino Due.  It is nice to be able to change what the Arduino Due is doing\nwithout having to do a whole compile-load cycle.  I have also used it for automated\ntesting on my [SimCPU](https://github.com/BrentSeidel/Sim-CPU) project and it has\nworked quite well.  Execution of the simulator can be scripted also allowing\ntesting and debugging of code running on the simulator.\n\nA set of test cases have been written and code coverage checked.  The\ntests are useful verify that code changes still work and have helped to\nfind a number of bugs in the software.  Code coverage has been checked\nbased on the tests and the coverage is just above 90% statement coverage.\n\n### Porting\nIt now runs on the Arduino Due.  It took a bit of work to remove all dependencies\non Ada libraries that aren't available on the Arduino Due.  Another feature added\nwas the ability for the host software to add custom lisp commands.  Thus, the\nmain Arduino Due program can add custom Lisp commands for accessing the Arduino\nhardware.  An example of this is the Ada-Lisp-Embedded repository at\nhttps://github.com/BrentSeidel/Ada-Lisp-Embedded\n\nThis Lisp interpreter also builds and runs on Windows 10 as well as a Raspberry\nPI under Raspberian.\n\n### Supported Data Types\n1. Integers are the standard Ada integer type.\n2. Strings are variable length and implemented using a linked list.\n3. Booleans are either \"T\" (true) or \"NIL\" (false).\n4. Characters are single ASCII characters (Unicode is not supported).\n5. Lists are linked lists of elements that can be of any datatype (even other lists)\n\n### Supported Operations\n1. Basic arithmetic\n2. Comparisons\n3. List operations - CAR and CDR\n4. DOWHILE/DOTIMES\n5. User defined functions and lambda functions.\n6. Local variables.\n7. Hardware access.  This is done by allowing the host software to add custom lisp\ncommands.  This may also be useful for embedding the lisp interpreter in other\napplications.\n8. Peek and Poke functions for accessing memory.  This is mainly for use on embedded\nsystems.\n9. Logical and bitwise logical operations AND, OR, NOT.\n\n### Non-Supported Features\nThere are others, but here are the main missing features.  Some of these may eventually\nbe implemented, others will never be implemented.  The goal is to have a useful\nlittle language, not another port of Common Lisp.\n1. Macros.  This is a long term goal.  I would like to implement these, but I need to\nfigure out how first.\n2. Object oriented features.  This will probably never happen.\n3. Closures.  This will probably never happen.\n4. Packages and similar large program related features.  Remember *Tiny* Lisp.\n\n### Roadmap\nThe following updates to the language are planned.  They may not be done in the\norder shown and other items may be added before some of these.\n1. Improved error handling and general code cleanup (ongoing).\n2. Convert the BBS.lisp package to a generic with the data structure sizes as\nparameters.  This will make it easier to resize things for specific targets.\n\n## Internals\n\n### Memory Management\nSince this is intended to run on embedded systems without any memory management, the memory\npools are pre-allocated and sized arrays from which objects can be allocated.  Each object\nhas a reference count and the object it freed when the number of references reaches 0.  Note\nthat reference counting is not automatic and has to be done manually.\n\nOne advantage that I've discovered about reference counting is that is usually\nquickly makes one aware that one has done something wrong.  Two types of errors\nare possible - prematurely dereffing an object or not dereffing an object.\n\nThe memory manager is probably not thread safe, though this could be an interesting\nproject.\n\n### Static Tables\nSymbols, cons cells, and strings are allocated from statically defined arrays.  This\ndesign decision was made to enable the interpreter to run on systems without any\nsort of dynamic memory management.  Basically, I rolled my own.  The size of these\ntables are set when compiling the interpreter and can be changed to suit your use.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrentseidel%2Fada-lisp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrentseidel%2Fada-lisp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrentseidel%2Fada-lisp/lists"}