Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions docs/source/adding-language.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,26 @@
Adding a Programming Language
=============================

To add compatability for a programming language in *multiplex*, you must create a language specification in ``multiplex/languages/__init__.py``.

The language should be added to the ``_REGISTRY`` as shown below:

.. code-block:: Python
_REGISTRY = {
"java": LanguageSpec(
name="java",
extension=".java", # the file extension for Java code files
ts_language=Language(ts_java.language()), # the TreeSitter Java library
def_node_types=frozenset({"method_declaration", "constructor_declaration"}), # the structures to mutate
comment_node_types=frozenset({"comment", "line_comment", "block_comment"}), # comments to ignore
fence="java", # the language decription used for code fences
noun="Java method", # noun for inserting in prompts
label="Java", # internal label
),
}

This example shows the Java language description using the TreeSitter library nodes to describe specific code structures such as comments and method definitions to enable *multiplex* to mutate the relevant code.

The user should import the relevant TreeSitter library for the language they are adding.
Currently, *multiplex* can only support languages supported by TreeSitter.

10 changes: 9 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ If you are specifically interested in Hazard Analysis approaches for guiding LLM

getting-started
existing-modules
configuration

.. toctree::
:hidden:
:maxdepth: 2
:caption: Extending

adding-language
adding-mutant-generation
adding-execution-and-evaluation


Loading