Welcome to the Portable Stimulus Grammar repository! This project provides formal grammar definitions for the Portable Stimulus Standard (PSS) using both ANTLR4 and Tree-sitter formats. The goal is to facilitate syntax analysis, tooling, and integration of PSS into various development environments.
To build the parser using ANTLR4:
-
Install ANTLR4: Follow the installation instructions on the ANTLR website.
-
Generate the Parser: Run the following command in the
ANTLR4/v3/directory:antlr4 pss.g4
This will generate the necessary parser and lexer files.
-
Integrate into Your Project: Include the generated files into your project and use them to parse PSS source code.
-
Test the Parser: Use the generated parser to parse sample PSS code and validate its syntax.
For more information on writing ANTLR4 grammars, refer to the ANTLR4 documentation.
To build the parser using Tree-sitter:
-
Install Node.js: Ensure that Node.js is installed on your system.
-
Install Tree-sitter CLI:
npm install -g tree-sitter-cli
-
Initialize the Project: Run the following command in the
TreeSitter/v3/directory:tree-sitter init
This will create the necessary files for the Tree-sitter parser.
-
Generate the Parser: Run the following command:
tree-sitter generate
-
Build the Parser: Compile the parser using the following command:
gcc -shared -o parser.so parser.c -I/path/to/tree-sitter/include
-
Test the Parser: Use the Tree-sitter CLI to parse sample PSS code and inspect the syntax tree.
For more information on writing Tree-sitter grammars, refer to the Tree-sitter documentation.
ANTLR4 supports code generation for the following target languages:
- Java
- C#
- Python 3
- JavaScript
- TypeScript
- Go
- C++
- Swift
- PHP
- Dart
For more details, refer to the ANTLR4 target languages documentation.
Tree-sitter provides official language bindings for the following languages:
- C#
- Go
- Haskell
- Java (JDK 22)
- JavaScript (Node.js)
- JavaScript (WASM)
- Kotlin
- Python
- Rust
- Zig
Additionally, there are community-maintained bindings available for different targets.
For more information, refer to the Tree-sitter official website.
This project is licensed under the MIT License. See the LICENSE file for more details.
Contributions are welcome! If you have suggestions, improvements, or bug fixes, please fork the repository and submit a pull request. Ensure that your changes are well-tested and adhere to the coding standards of the project.
- Portable Stimulus Standard (Accellera)
- Portable Stimulus Standard LRM (Accellera)
- Getting started with ANTLR4
- Tree-sitter Writing the Grammar
Feel free to explore the repository, and don't hesitate to reach out if you have any questions or need further assistance!