Lisp implemented in Rust macros
The `lisp-in-rs-macros` project is a Rust-based Lisp interpreter using macros, supporting compile-time evaluation and various constructs, but lacking explicit recursion. Future updates may include `letrec` support.
Read original articleThe `lisp-in-rs-macros` project is a simple Lisp interpreter implemented in Rust using declarative macros. It features the `lisp!` macro, which allows users to write Lisp expressions that are evaluated at compile time, such as `lisp!(CAR (CONS (QUOTE A) (QUOTE (B))))`, which expands to "A". The interpreter is concise, comprising fewer than 250 lines of code, and supports various Lisp constructs including `DEFINE`, `QUOTE`, `LAMBDA`, `LET`, `PROGN`, `CAR`, `CDR`, `CONS`, `LIST`, `EQ`, `ATOM`, and `APPLY`. However, it does not support explicit recursion directly, although recursive behavior can be achieved through lambda functions. The repository includes examples, including a quine, demonstrating the use of the `lisp!` macro. Limitations include the lack of support for dotted lists and recursive definitions in the `DEFINE` form. The author intends to enhance the interpreter by adding features like `letrec` and recursive definitions in the future. Additional resources for functional programming and language implementation are also provided in the repository.
- The `lisp-in-rs-macros` project is a Lisp interpreter built with Rust macros.
- It allows compile-time evaluation of Lisp expressions using the `lisp!` macro.
- The interpreter supports various Lisp constructs but lacks explicit recursion.
- Future enhancements may include support for `letrec` and recursive definitions.
- The repository contains examples and resources for further learning.
Related
Tonsky: Don't go crazy with Clojure unless it makes you happy
The author shares their journey using Clojure macros for Humble UI's component library, emphasizing the language's flexibility in enabling unconventional solutions like reading source files and fetching code seamlessly.
Clojure macros continue to surprise me
The author shares their journey using Clojure macros for Humble UI's component library, creating a macro to display running code alongside its source. Despite challenges, they find Clojure's flexibility rewarding for experimentation.
Show HN: Lisp in C#
The GitHub URL provides details about "sharpl," a custom Lisp interpreter in C#. It includes features like lexical/dynamic scope, branching, method definition, lambdas, closures, varargs, and more. Visit https://github.com/codr7/sharpl for details.
Ask HN: Why do people say "Lisp has no syntax"? It has infinite syntax
The author discusses Lisp's syntax, highlighting its list-based structure and challenges with constructs like `cond`. They conclude that Lisp's complexity resembles other languages, despite its unique features.
Quote-unquote "macros"
The blog post examines macros in the Janet programming language, highlighting their advantages over traditional memoization, particularly in compile-time storage allocation and the significance of quoting and unquoting in macro development.
- Some users express concerns about the complexity of Rust and its impact on the simplicity of Lisp.
- There are discussions about limitations in defining symbols, particularly regarding the use of dashes in identifiers.
- Users are curious about the memory safety and borrow checker features of Rust in relation to the Lisp implementation.
- Several comments highlight enthusiasm for the project, with users finding it fun and interesting.
- References to existing Lisp rules and comparisons to other languages like C++ are made, indicating a broader context of programming language discussions.
Related
Tonsky: Don't go crazy with Clojure unless it makes you happy
The author shares their journey using Clojure macros for Humble UI's component library, emphasizing the language's flexibility in enabling unconventional solutions like reading source files and fetching code seamlessly.
Clojure macros continue to surprise me
The author shares their journey using Clojure macros for Humble UI's component library, creating a macro to display running code alongside its source. Despite challenges, they find Clojure's flexibility rewarding for experimentation.
Show HN: Lisp in C#
The GitHub URL provides details about "sharpl," a custom Lisp interpreter in C#. It includes features like lexical/dynamic scope, branching, method definition, lambdas, closures, varargs, and more. Visit https://github.com/codr7/sharpl for details.
Ask HN: Why do people say "Lisp has no syntax"? It has infinite syntax
The author discusses Lisp's syntax, highlighting its list-based structure and challenges with constructs like `cond`. They conclude that Lisp's complexity resembles other languages, despite its unique features.
Quote-unquote "macros"
The blog post examines macros in the Janet programming language, highlighting their advantages over traditional memoization, particularly in compile-time storage allocation and the significance of quoting and unquoting in macro development.