merge interpreter.md into readme #4

Merged
giteadmin merged 4 commits from fix/readme into main 2024-12-26 10:30:26 +00:00
Showing only changes of commit 07c7dc233b - Show all commits
+5 -24
View File
@@ -81,30 +81,6 @@ We accumulate these descriptors in an array. Then, later, we push them _in rever
- If `SUBLIST`, parse that sublist into descriptors, then push those in reverse. - If `SUBLIST`, parse that sublist into descriptors, then push those in reverse.
## How to Contribute
1. **Add New Instructions**
- Expand `OpCode` enum (e.g. `INTEGER_MINUS`, `INTEGER_MUL`, etc.).
- Write a `makeInstruction` or `makeIntLiteral` function to build the descriptor for it.
- In the main loop, implement the logic (pop the correct number of integers, do the operation, push the result).
2. **Support More Data Types**
- For instance, a `FLOAT` or `BOOLEAN` stack.
- Add a new tag (`FLOAT_LITERAL`?), new instructions (`FLOAT.PLUS`?), etc.
3. **Improve Parsing**
- If you want 256-bit literals, define a new token that reads 32 bytes, or do other expansions (like `CODE` type).
- Or define advanced sublist structures (like nested `( ( ) )` expansions).
4. **Gas Optimization**
- Check how large arrays are allocated (like in `parseSublist`).
- Possibly implement step-by-step execution if large code exceeds block gas limits.
5. **Add Logging & Debug Tools**
- Use `console.log(...)` to trace tokens, track final states, or measure performance.
6. **Test Coverage**
- Provide more unit tests in Foundry for advanced instructions, nested sublists, edge cases with zero-length sublists, etc.
## Next Steps ## Next Steps
@@ -130,6 +106,11 @@ This `Push3Interpreter` is a **minimal** scaffold for a token-based, list-expand
3. **Add** or modify instructions & sublists in `parseSublist` and `runInterpreter`. 3. **Add** or modify instructions & sublists in `parseSublist` and `runInterpreter`.
4. **Run** `forge test --via-ir -vv` to see logs and confirm your changes. 4. **Run** `forge test --via-ir -vv` to see logs and confirm your changes.
### How to contribute
Check the [Issues](../../../issues) section to find tasks to tackle.
## 🛠️ Roadmap ## 🛠️ Roadmap
- **Core Features:** - **Core Features:**