Caustic's parsing framework
Project description
Caustic's Parser -- uses grammar specification to compile Caustic source code into a CST (Caustic AST)
Uses ParGlare for parsing, meant to work with CausticGrammar to create a CST (Caustic AST)
CLI usage
See cap --help
Example module usage
import sys
import parglare
from pathlib import Path
from caustic.parser import CausticParser
from caustic.parser.error import format_exc
# CausticParser.from_file() loads the grammar using ParGlare,
# then invokes CausticParser.from_grammar(), which creates a ParGlare
# parser instance and uses that to finally create the parser
p = CausticParser.from_file(Path('<your-grammar-file>'))
try:
print(p.parse(input()))
except parglare.ParseError as e:
# custom error formatting (optional)
print(format_exc(e), file=sys.stderr)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
caustic.parser-2.2.5.tar.gz
(10.0 kB
view hashes)
Built Distribution
Close
Hashes for caustic.parser-2.2.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d9cc85607fbd0f15553e2fbb9a3fcbac233b6413f13cff19f2c17feb33aebe2 |
|
MD5 | 05af123af7a697bbf073b253cfd47c39 |
|
BLAKE2b-256 | c80a673f7506fe3f362ec12dcf0a4ca9f47b19bac36259fdbfd0de2552a0c22b |