AI prompts
base on The standalone Linux Lisp # lone
The standalone Linux Lisp
Lone is a freestanding Lisp interpreter
designed to run directly on top of the Linux kernel
with full support for Linux system calls.
It has zero dependencies, not even the C standard library.
Currently in the early stages of development.
```lisp
(import (lone) (linux system-call))
(system-call 'write 1 "Hello, world!" 13)
```
## Features and road map
- [x] Byte buffers
- [x] Texts
- [x] Symbols
- [x] Lists
- [x] Vectors
- [x] Tables
- [x] Prototypal inheritance
- Hash functions
- FNV-1a
- [ ] Numbers
- [x] Integers
- [x] Signed
- [ ] Floating point
- [x] Pointers
- [x] Modules
- [x] Functions
- [x] Primitive
- [x] Variadic
- [x] FEXPR
- [ ] Linux
- [x] System calls
- [ ] Structures
- [x] Process parameters
- [x] Arguments
- [x] Count
- [x] Vector
- [x] Environment vector
- [x] Auxiliary vector
- [ ] Loadable embedded ELF segment
- [x] Code evaluation
- [ ] Module importing
- [ ] Interpreter configuration
- [x] Tools
- [x] Memory allocator
- [x] Garbage collector
## Building
Lone is built by a simple GNU Make file.
The following phony targets can be used:
make
make clean
make lone
make tools
make clean lone
make clean lone tools
The following variables are recognized:
make CFLAGS=-g
make LD=mold
make LTO=yes
make UAPI=/alternative/linux/uapi/headers
make TARGET=x86_64 UAPI=/linux/uapi/headers/x86_64
Currently supported targets:
- `x86_64`
- `aarch64`
## Testing
Lone has an automated test suite that exercises language features.
Any of the following commands can be used to run it:
make test
make clean test
scripts/test.bash $test_suite $lone_executable $compiled_test_case_path
### Adding new test cases
<details>
<summary>How the test cases are organized and run</summary>
New tests are added by creating directories inside `test/`,
forming an arbitrary directory tree which determines the test name.
Leaf directories contain the test files used to exercise lone.
The following files may be present:
- `arguments` Arguments to be passed, one per line.
- `environment` Environment variables to be set, one per line.
- `input` Standard input.
- `output` Expected standard output.
- `error` Expected standard error.
- `status` Expected exit status code.
Tests are run in parallel by executing the lone interpreter
with the specified arguments, environment and standard input.
The status code and the data from standard output and error
are collected and compared against the expected parameters.
A successful test is one where actual outputs match expected outputs.
Only the `input` file is absolutely required.
The actual output and error data are only compared
if their respective `output` and `error` files are present.
If the `status` file is omitted,
the successful status code `0` is expected.
</details>
## Project structure
<details>
<summary>Description of the structure of the repository</summary>
lone/ # The lone repository
├── build/ # The build tree
├── include/ # Header files
├── source/ # Source files
├── architecture/ # Architecture-specific tree
├── scripts/ # Development tools and test suite
├── test/ # The lone test suite
├── GNUmakefile # The build system
├── LICENSE.AGPLv3 # Full license text of the GNU AGPLv3
├── README.md # This README file
├── .gdbinit # GDB visualization functions for lone's data structures
└── .github/ # GitHub-specific data
lone/include/ # Added to compiler include directories
└── lone/ # Lone namespace
├── hash/ # Hash function implementations
│ └── fnv_1a.h # Fowler–Noll–Vo hash function
├── lisp/ # Lone lisp language features
│ ├── constants.h # Constants like nil and true
│ ├── evaluator.h # Evaluates lone values
│ ├── printer.h # Writes lone values into text
│ └── reader.h # Reads text into lone values
├── memory/ # Lone's memory subsystem
│ ├── allocator.h # General memory block allocator
│ ├── functions.h # Memory moving and filling functions
│ ├── garbage_collector.h # The lone garbage collector
│ └── heap.h # The lone value heap
├── modules/ # Intrinsic lone modules
│ ├── intrinsic/ # Modules built into the interpreter
│ │ ├── linux.h # Linux system calls and process parameters
│ │ ├── list.h # List manipulation functions
│ │ ├── lone.h # Lone language primitives
│ │ ├── math.h # Mathematical functions
│ │ └── text.h # Text manipulation functions
│ ├── intrinsic.h # Bulk initializer for all built-in modules
│ └── embedded.h # Modules embedded into the interpreter
├── value/ # Functions for each type of value
│ ├── bytes.h # Creation and transfer functions
│ ├── function.h # Function and closure instantiation
│ ├── integer.h # Integer value creation and parsing
│ ├── list.h # List construction and processing
│ ├── module.h # Module value creation
│ ├── pointer.h # Typed pointer value creation
│ ├── primitive.h # Primitive C function binding creation
│ ├── symbol.h # Symbol creation and interning
│ ├── table.h # Hash table creation and operations
│ ├── text.h # Text value creation and C string transfers
│ └── vector.h # Vector creation and operations
├── definitions.h # Defined constants and macros
├── hash.h # General hashing functions
├── linux.h # Linux system calls used by lone
├── lisp.h # Lone lisp interpreter initialization
├── memory.h # Lone memory subsystem initialization
├── modules.h # Module loading, search, path management
├── types.h # Primitive and aggregate type definitions
├── utilities.h # Useful functions
└── value.h # Blank slate lone value creation
lone/source/ # Lone lisp implementation source code
├── tools/ # General use utilities and development tools
│ └── lone-embed.c # Embeds code into a lone interpreter executable
├── lone/ # Matches the structure or the include/ directory
└── lone.c # The main lone function
lone/architecture/
└── $ARCH/
└── include/ # Added to compiler include directories
└── lone/architecture/
├── linux/
│ ├── entry_point.c # Process start code
│ └── system_calls.c # Linux system call stubs
└── garbage_collector.c # Register spilling code
lone/build/
└── $ARCH/ # The targeted architecture
├── include/ # Added to compiler include directories
│ └── lone/
│ └── NR.c # Generated Linux system call table initializers
├── objects/ # Compiled object files; mirrors source tree structure
├── tools/ # Compiled utilities and tools
│ └── lone-embed # Embeds code into a lone interpreter executable
├── prerequisites/ # Prerequisite files; mirrors source tree structure
├── NR.list # List of system calls found on the targeted Linux UAPI
└── lone # The built lone lisp freestanding executable
lone/scripts/
├── NR.filter # Extracts system call definitions from compiler output
├── NR.generate # Generates C structure initializers for system call names and numbers
├── test.bash # The automated test suite script
└── test.new # The new test case creation script
lone/test/
└── arbitrary/tree/ # Arbitrary tree, determines test name, leaves contain test files
├── arguments # Arguments passed, one per line
├── environment # Environment variables set, one per line
├── input # Standard input
├── output # Expected standard output
├── error # Expected standard error
└── status # Expected exit status
lone/.github/
├── workflows/ # GitHub Actions workflows
│ ├── codeql.yml # Automated code quality checker
│ └── lone.yml # Automated building and testing
└── FUNDING.yml # Funding information
</details>
", Assign "at most 3 tags" to the expected json: {"id":"4718","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"