Coder Social home page Coder Social logo

shayne-fletcher / pyre-ast Goto Github PK

View Code? Open in Web Editor NEW

This project forked from grievejia/pyre-ast

0.0 0.0 0.0 31.1 MB

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.

License: MIT License

Perl 32.96% C 26.86% OCaml 40.18%

pyre-ast's Introduction

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.12.0
$ opam install . --deps-only --with-test
$ dune build @install  # Build the library
$ dune test            # Run tests

pyre-ast's People

Contributors

grievejia avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.