Skip to content

AlexanderGolys/tree-sitter-macaulay2

Repository files navigation

tree-sitter-macaulay2

Macaulay2 grammar for tree-sitter.

Features

  • Highlighting (highlights.scm)
  • Indentation (indents.scm)
  • Symbol Tags (tags.scm)
  • Folds (folds.scm)
  • Local variables and scopes (locals.scm)

Automatic test generation

The repository includes a Macaulay2-based test generation script that automates the creation of Tree-sitter corpus tests by using Macaulay2's internal disassemble function to obtain the ground-truth AST.

Note: This script requires Macaulay2 to be installed and available in your PATH as M2.

Usage

  1. Add expressions: Place Macaulay2 code in .m2 files within test/test_generator/test_expressions/. Each non-empty line is treated as a separate test case.
  2. Generate tests: Run the generation script from the project root:
    bash test/test_generator/generate_tests.sh
  3. Verify: Run the Tree-sitter test suite:
    tree-sitter test

The script generates .txt corpus files in test/corpus/ prefixed with auto_generated_. This ensures the parser's output exactly matches the behavior of the real Macaulay2 parser.

References

License

MIT (see LICENCE)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors