Metadata-Version: 2.4
Name: seclang_parser
Version: 0.3.2
Summary: SecLang Parser using ANTLR
Project-URL: issues, https://github.com/coreruleset/seclang_parser/issues
Project-URL: homepage, https://github.com/coreruleset/seclang_parser
Project-URL: repository, https://github.com/coreruleset/seclang_parser.git
Author-email: Felipe Zipitria <felipe.zipitria@owasp.org>, Agustin de Leon <adeleon@fing.edu.uy>
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: CRS,Coraza,ModSecurity,OWASP,SecLang
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.11
Requires-Dist: antlr4-python3-runtime>=4.13.2
Description-Content-Type: text/markdown

# SecLang ANTLR based parser

This repo contains the ANTLR files for a SecLang parser.

## Why a new parser?

There has been efforts towards having parsers in different languages. Using ANTLR would allow us to have a common parser and generate parsing engines for different languages easily.
This way we would consolidate efforts, and we can have a more robust parser.

## Features we (might) want

- Agnostic: no language dependent, parser should be independent of the destination language.
- High Level: writing low level dependent parsing rules is prone to error and makes the language more difficult.
- Can be used from native code, e.g, no dependencies or CGo (this might hurt Coraza, for example)
- Can generate in many languages, and be read and extended by everyone.
- We choose one base implementation language (Python/Go?) and anyone can contribute others.

## Usage

Right now this repo contains the ANTLR files and golang and python 3 basic tests.

To run the tests:

```bash
go generate ./...
go test ./...
```

Or for python:

- Get [uv](https://github.com/astral-sh/uv) first
```bash
cd parser
./generate.sh
cd ..
uv sync --all-extras --dev
uv run pytest -vs
```

## Authors

Felipe Zipitria <felipe.zipitria@owasp.org>
