A library for parsing and interpreting CEDARScript, a SQL-like language for code analysis and transformations
Project description
CEDARScript AST Parser
CEDARScript AST Parser
is a Python library for parsing and interpreting CEDARScript
, a SQL-like language designed for concise code analysis, manipulation, and refactoring tasks.
What is CEDARScript?
CEDARScript (Concise Examination, Development, And Refactoring Script) is a domain-specific language that aims to improve how AI coding assistants interact with codebases and communicate their code modification intentions. It provides a standardized way to express complex code modification and analysis operations, making it easier for AI-assisted development tools to understand and execute these tasks.
Features
- Parse
CEDARScript
Abstract Syntax Tree (AST
) that was generated by Tree-Sitter into a list of commands - Support for various code manipulation and analysis commands (CREATE, UPDATE, RM, MV, SELECT)
- Return results in
XML
format for easier parsing and processing by LLM systems
Installation
You can install CEDARScript Parser using pip:
pip install cedarscript-ast-parser
Usage
Here's a quick example of how to use CEDARScript Parser:
from cedarscript_ast_parser import CEDARScriptASTParser
parser = CEDARScriptASTParser()
code = """
CREATE FILE "example.py"
UPDATE FILE "example.py"
INSERT AT END OF FILE
CONTENT
print("Hello, World!")
END CONTENT
END UPDATE
"""
commands, errors = parser.parse_script(code)
if errors:
for error in errors:
print(f"Error: {error}")
else:
for command in commands:
print(f"Parsed command: {command}")
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License.
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
Built Distribution
File details
Details for the file cedarscript_ast_parser-0.2.11.tar.gz
.
File metadata
- Download URL: cedarscript_ast_parser-0.2.11.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7842efefbe394a5905ebd0a354b7c6b6096dd0491be2cd78676c5e821b0876f5 |
|
MD5 | 409e531e15e65f3148533d085b38f34e |
|
BLAKE2b-256 | 06164ed728ab55b611bb7b33f60a313c752d05ea7f27d2af5be4f6a18c9b0e98 |
File details
Details for the file cedarscript_ast_parser-0.2.11-py3-none-any.whl
.
File metadata
- Download URL: cedarscript_ast_parser-0.2.11-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04b5052e13ec8ed9bfcb569897cfa7208ae8e79c4e660d3d70325f51a6074ba8 |
|
MD5 | ab63dedc34a942db6c3df2a40a6120fc |
|
BLAKE2b-256 | 1f6bdd70e1926b0def615b6d623c6fdb3febd3cbb7d5ec1da2766feccfb97b76 |