An open API service indexing awesome lists of open source software.

https://github.com/dfgordon/tree-sitter-merlin6502

Parser for Merlin 6502 assembly language
https://github.com/dfgordon/tree-sitter-merlin6502

Last synced: 6 months ago
JSON representation

Parser for Merlin 6502 assembly language

Awesome Lists containing this project

README

          

# Parser for Merlin 6502 Assembly

![unit tests](https://github.com/dfgordon/tree-sitter-merlin6502/actions/workflows/rust.yml/badge.svg)

This is a parser for Merlin assembly language intended for use with language servers. It is built using the [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) system. The native parser is a C library. Bindings are possible for several languages, but only the [rust crate](https://crates.io/crates/tree-sitter-merlin6502) is actively maintained. There is a [node package](https://github.com/dfgordon/tree-sitter-merlin6502/pkgs/npm/tree-sitter-merlin6502) that can be updated upon request.

For details on parser usage and design see the [wiki](https://github.com/dfgordon/tree-sitter-merlin6502/wiki).

## Pre-Build Process

If you are changing the grammar, be aware the file `grammar.js` is actually generated by the metaprogram `opcode_processor.py`. This takes `grammar-src.js`, `opcodes.json`, and `pseudo_opcodes.json` as inputs.

## Build Process

Once you have `grammar.js` you run `tree-sitter generate` to produce `src/parser.c` and, in turn, the bindings for whatever languages are specified in `tree-sitter.json`. If you want to compile a WASM parser you can follow up with `tree-sitter build -w`.

## Build Script

The `build.py` script takes care of all of the above steps, and will also run the tests.

## References

* Merlin 8/16 Manual, copyright 1987, Roger Wagner Publishing, Inc.
* Merlin 16+ Manual, copyright 1988-1989, Roger Wagner Publishing, Inc.
* [Merlin 32 Documentation](https://brutaldeluxe.fr/products/crossdevtools/merlin/)