• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

qfpl/hpython: Haskell language tools for Python

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

qfpl/hpython

开源软件地址(OpenSource Url):

https://github.com/qfpl/hpython

开源编程语言(OpenSource Language):

Python 78.8%

开源软件介绍(OpenSource Introduction):

hpython

Haskell-based language tools for Python

CSIRO's Data61 Logo

hpython provides an abstract syntax tree for Python 3.5, along with a parser, printer, and syntax checker. It also contains optics for working with the AST, and a DSL for writing Python programs directly in Haskell.

Features

  • Formatting-preserving syntax tree
  • Parser and printer, with a round-trip law: print ∘ parse ≡ id
  • Optics for manipulating the syntax tree
  • Indentation, syntax, and scope checking
  • The syntax tree is indexed by its level of validation, to distinguish between syntactically valid Python and unvalidated code
  • Convenient DSL for building Python programs

Examples

See the example directory

FAQ

Why not just use language-python?

There are two main reasons:

  1. We think the print-parse identity is important. language-python discards lexical information like indentation levels and spacing, which means there is big cost to using it to modify human-written code. hpython retains formatting information in a way that has minimal impact when using the library. This means that program transformations change as little formatting as possible.

  2. We want to use types to precisely model the domain. language-python unifies Python 2 and 3 into a single data structure. We disagree with this choice, because Python 2 and 3 have different, non-compatible features. In Haskell terms, they are different datatypes with a large amount of overlap. Our goal is to make this difference visible in the type system without increasing code repetition.

    There are other minor places where language-python has made similar concessions, like in the treatment of 'starred expressions' (which are not really expressions at all).

Development Pipeline

  • Support other versions of Python while re-using as much common code as possible
  • Style configs for the DSL
  • Human readable validation errors, with source spans

Contribution

Feel free to file an issue or pull request on Github, or contact us at:

IRC - #qfpl on Freenode Email - <oᴉ˙ldɟb@llǝʞsɐɥ>




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
gelisam/hawk: Haskell text processor for the command-line发布时间:2022-06-24
下一篇:
Ulasan Terkait Judi Online Slot, Poker, Bola &amp; Casino发布时间:2022-06-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap