Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elton2048/glizp
Lisp interpreter in zig; Learning purpose mainly
https://github.com/elton2048/glizp
learning lisp zig
Last synced: 10 days ago
JSON representation
Lisp interpreter in zig; Learning purpose mainly
- Host: GitHub
- URL: https://github.com/elton2048/glizp
- Owner: elton2048
- Created: 2024-08-07T07:00:38.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-10-18T07:17:28.000Z (4 months ago)
- Last Synced: 2024-10-19T14:29:26.180Z (4 months ago)
- Topics: learning, lisp, zig
- Language: Zig
- Homepage:
- Size: 47.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Lisp Interpreter in zig
Build script
```sh
zig build
```# Note
Zig requires manual memory management, some memory are required to be freed for better main program and test cases, noticeably the following items
- ArrayList (by `arrayList.deinit()`)
- Slice from ArrayList (Could be `allocator.free(SLICE)`, by then the array list is not required to be freed. If it is not wrapped in allocator some manual way shall be used.)# Patch note
The [regex library](https://github.com/tiehuis/zig-regex) used requires patch in order to support non-capturing group for tokenization process. Please refer to https://github.com/elton2048/zig-regex/tree/feat-complex-group-support
Another fix for allowing repeat tokens shows as follow:
In `src/regex.zig`
```
pub fn isByteClass(re: *const Expr) bool {
switch (re.*) {
.Literal,
.ByteClass,
.AnyCharNotNL,
// TODO: Don't keep capture here, but allow on repeat operators.
.Capture,
+ .Repeat,
=> return true,
else => return false,
}
}
```