All Projects → grievejia → pyre-ast

grievejia / pyre-ast

Licence: MIT license
pyre-ast is an OCaml library to parse Python files. The library features its full-fidelity to the official Python spec, as well as its adoption of tagless-final style.

Programming Languages

ocaml
1615 projects
perl
6916 projects
c
50402 projects - #5 most used programming language

Labels

Projects that are alternatives of or similar to pyre-ast

deco
Minimalist Function Decorators for Elixir
Stars: ✭ 21 (-16%)
Mutual labels:  ast
nast
A block-based intermediate representation for document-like content.
Stars: ✭ 35 (+40%)
Mutual labels:  ast
sass-lint-auto-fix
Automatically resolve s(a|c)ss linting issues
Stars: ✭ 93 (+272%)
Mutual labels:  ast
macro-visit
A macro-based generic visitor generator
Stars: ✭ 23 (-8%)
Mutual labels:  ast
snapdragon-util
Utilities for the snapdragon parser/compiler.
Stars: ✭ 17 (-32%)
Mutual labels:  ast
rector-doctrine
Rector upgrades rules for Doctrine
Stars: ✭ 37 (+48%)
Mutual labels:  ast
parser-reflection
Parser Reflection API - Provides source code analysis without loading classes into the PHP memory
Stars: ✭ 97 (+288%)
Mutual labels:  ast
py-lua-parser
A Lua parser and AST builder written in Python.
Stars: ✭ 69 (+176%)
Mutual labels:  ast
language-rust
Parser and pretty-printer for the Rust language
Stars: ✭ 78 (+212%)
Mutual labels:  ast
sql-parser
Parse SQL (select) statements into abstract syntax tree (AST) and convert ASTs back to SQL.
Stars: ✭ 230 (+820%)
Mutual labels:  ast
subpy
Python subsets
Stars: ✭ 41 (+64%)
Mutual labels:  ast
lilt
LILT: noun, A characteristic rising and falling of the voice when speaking; a pleasant gentle accent.
Stars: ✭ 18 (-28%)
Mutual labels:  ast
codeparser
Parse Wolfram Language source code as abstract syntax trees (ASTs) or concrete syntax trees (CSTs)
Stars: ✭ 84 (+236%)
Mutual labels:  ast
TypeScriptAST
.NET port of Microsoft's TypeScript parser for simple AST manipulation
Stars: ✭ 37 (+48%)
Mutual labels:  ast
parcera
Grammar-based Clojure(script) parser
Stars: ✭ 100 (+300%)
Mutual labels:  ast
BBob
⚡️Blazing-fast js-bbcode-parser, bbcode js, that transforms and parses to AST with plugin support in pure javascript, no dependencies
Stars: ✭ 133 (+432%)
Mutual labels:  ast
vscode-ast
Show JavaScript / TypeScript Abstract Syntax Tree
Stars: ✭ 34 (+36%)
Mutual labels:  ast
stack-editor
[Deprecated, prefer calcit-editor]
Stars: ✭ 93 (+272%)
Mutual labels:  ast
pyccolo
Declarative instrumentation for Python.
Stars: ✭ 70 (+180%)
Mutual labels:  ast
MarkdownSyntax
☄️ A Type-safe Markdown parser in Swift.
Stars: ✭ 65 (+160%)
Mutual labels:  ast

pyre-ast

pyre-ast is an OCaml library to parse Python files.

The library features its full-fidelity to the official Python spec. Apart from a few technical edge cases, as long as a given file can be parsed by the CPython interpreter, pyre-ast will be able to parse the file without any problem. Furthermore, abstract syntax trees obtained from pyre-ast is guaranteed to 100% match the results obtained by Python's own ast.parse API, down to every AST node and every line and column number.

Another notable feature of this library is that it represents the Python syntax using the tagless-final style. This style typically offers more flexibility and extensibility for the downstream consumers of the syntax, and allow them to build up their analysis without explicitly constructing a syntax tree. On the other hand, this library does offer a tranditional "concrete" syntax tree structure as well, for developers who are less familiar with the tagless-final approach and more familiar with standard algebraic data type representation.

Installation

It is recommended to use opam for package management. To install pyre-ast with opam, you can run:

opam install pyre-ast

Usage

It is recommended to use dune as your build system. To use pyre-ast in your dune project, you can add pyre-ast to the libraries stanza in your dune file. For example,

(library
  (name mylib)
  (libraries pyre-ast))

Documentation of this library can be found here.

Development

It is recommended to use a local switch for development:

$ git clone https://github.com/grievejia/pyre-ast.git
$ cd pyre-ast
$ opam switch create ./ 4.14.0 --deps-only --with-test
$ dune build @install  # Build the library
$ dune test            # Run tests
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].