RustPython / RustPython/Parser
A macro to generating AST with python grammar
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 117
- Forks
- 38
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 1
Description
Inspired by https://docs.rs/pmutil/latest/pmutil/macro.smart_quote.html
e.g.
ExprKind::Tuple(ast::ExprTuple {
elts: names
.iter()
.map(|&name| {
create_expr(ExprKind::Constant(
ast::ExprConstant {
value: Constant::Str(name.to_string()),
kind: None,
},
))
})
.collect(),
ctx: ExprContext::Load,
}))
can be rewritten to:
&python_ast! {
Vars { names },
"(*names)"
}
The grammar will be limited to legal python codes to leverage python parser.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the referenced pmutil smart_quote macro and the proposed python_ast! invocation in this issue. Investigate the parser and AST-generation entry points in RustPython/Parser before deciding how the Python grammar should be constrained. Done means the macro can turn legal Python snippets plus supplied bindings into the corresponding AST.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100