{"id":16747924,"url":"https://github.com/amake/tinylisp","last_synced_at":"2025-04-10T13:52:14.811Z","repository":{"id":57740970,"uuid":"163841262","full_name":"amake/TinyLisp","owner":"amake","description":"A very simple Lisp for Java","archived":false,"fork":false,"pushed_at":"2023-01-18T00:22:15.000Z","size":418,"stargazers_count":7,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T12:39:10.951Z","etag":null,"topics":["android","java","lisp","repl","scripting"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amake.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-02T12:58:26.000Z","updated_at":"2025-01-10T05:41:24.000Z","dependencies_parsed_at":"2023-01-29T19:15:41.531Z","dependency_job_id":null,"html_url":"https://github.com/amake/TinyLisp","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amake%2FTinyLisp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amake%2FTinyLisp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amake%2FTinyLisp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amake%2FTinyLisp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amake","download_url":"https://codeload.github.com/amake/TinyLisp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248228687,"owners_count":21068737,"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":["android","java","lisp","repl","scripting"],"created_at":"2024-10-13T02:11:17.569Z","updated_at":"2025-04-10T13:52:14.786Z","avatar_url":"https://github.com/amake.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TinyLisp for Java\nTinyLisp is a very simple Lisp implementation for Java. It is heavily inspired\nby Peter Norvig's [lis.py](http://norvig.com/lispy.html).\n\n![demo](https://user-images.githubusercontent.com/2172537/52416817-d941c680-2b2d-11e9-83b2-f02a218f32bb.gif)\n\nThe above demo shows the REPL on Android and illustrates input assist,\nauto-formatting, symbol completion, history, and sharing.\n\n## Motivation\nImagine you are working with a proprietary software vendor who provides you with\na native binary compiled for Android. You want to test out the binary, seeing\nwhat kinds of outputs you might get from various inputs.\n\nI was in this position and my first thought was to load it up in a REPL of some\nsort. But [JSR\n223](https://en.wikipedia.org/wiki/Scripting_for_the_Java_Platform)-compatible\nscripting engines did not appear to work on Android, so I decided to make my\nown.\n\nThus the goal of this implementation is to drive a REPL to interact with Java\nobjects.\n\n## Features\n- Basic Lisp things: symbols, lists, strings, numbers, `lambda`, `car`, `cdr`,\n  `cons`, `list`, `quote`, etc.\n- Numbers are parsed as Java `int` or `double`, but are automatically promoted\n  to `BigDecimal` if necessary when performing arithmetic\n- First-class support for Java arrays: `[1 2 3]` is parsed as `int[]`, `[0.1 0.2\n  0.3]` as `double[]`; mixed or other arrays are `Object[]`\n- Java `null`, `true`, `false`\n- Android compatibility\n\n## Extras\n- [cmd](./cmd):\n  - A command-line interpreter that can execute files or be a REPL\n  - A command-line formatter that auto-formats code in an opinionated way\n- [formatter](./formatter): The library that powers the formatter\n- [activity](./activity): An Android library providing a TinyLisp REPL activity\n- [app](./app): An Android app for the activity\n\n## Usage\n### Command line\nBinaries are available in\n[Releases](https://github.com/amake/TinyLisp/releases). Run the appropriate\nexecutable in the `bin` folder.\n\nTinyLisp interpreter:\n\n```sh\n$ echo '(+ 1 2 3)' | ./bin/tinylisp\n6\n$ echo '(+ 1 2 3)' \u003e program.lisp\n$ ./bin/tinylisp program.lisp\n6\n$ ./bin/tinylisp # No args or stdin launches REPL\n```\n\nFormatter:\n\n```sh\n$ echo \"(let ((a 1)(b 2))   (+ a b)'foo)\"| ./bin/tlfmt\n(let ((a 1)\n      (b 2))\n (+ a b)\n 'foo)\n```\n\n### Engine\nThe TinyLisp engine is available as a Maven-style dependency:\n\n```\nimplementation 'org.tinylisp:engine:+'\n```\n\nTo execute a TinyLisp program, use the `Engine` and `TLEnvironment` classes as\nfollows. The result is a `TLExpression`.\n\n```java\nEngine engine = new Engine();\nTLEnvironment env = Engine.defaultEnvironment();\nTLExpression result = engine.execute(\"(+ 1 2 3)\", env); // 6\n```\n\n### Formatter\nThe formatter is also available as a package:\n\n```\nimplementation 'org.tinylisp:formatter:+'\n```\n\n### Android REPL activity\nThe Android REPL activity is also available as a package:\n\n```\nimplementation 'org.tinylisp:activity:+'\n```\n\nThe activity class is `org.tinylisp.activity.ReplActivity`.\n\n## Requirements\nThe engine, formatter, and CLI executables require Java 8+.\n\nThe Android REPL activity targets API 32 (min API 15).\n\n## Limitations\n- The point is to be small and simple, so many standard commands are missing\n  (PRs welcome)\n- No thought has been put into speed or efficiency\n- [Homoiconicity](https://en.wikipedia.org/wiki/Homoiconicity) goes out the\n  window when printing arbitrary Java objects\n\n## Notes\nThis TinyLisp is unrelated to any other projects with similar names.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famake%2Ftinylisp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famake%2Ftinylisp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famake%2Ftinylisp/lists"}