补注: 在彻底了解mulan源码后和中科院处理结果后,我认为木兰从动机上有可能并无过错。 他确实实现了一些东西,"套壳"说法不合适。 这些东西在我们编译器相关专业的人眼中菜得一匹,唯三可赞之处,最大的不过一个lambda lifting。 这是我主要持批评态度的原因。 但并非所有批评都是合适,他至少比较直接地解决了一些python低端黑黑python的点。 以非专业水准做到这点实属不易,可以作出一定的肯定。
muridesu
听说最近有人想用Python编译器骗经费?
还用的是PLY?! 这都0202年了我的天.
您好,这儿是一位不愿透露姓名的你红姐制作的一个木兰那样的语言, 学你们木兰, 只有前端, 编译到Python.
居然用了我三个小时零28分钟!加上从QQ里爬出来开机建项目的时间.
语法如下,见excuse_me.muridesu.
func f(x, seq){
for i in seq
{
print(i + x)
}
}
f(1, [2, 3, 4])
class A {
func f(self){
print("A")
}
}
class S <: A {
func g(self){
print("S")
}
}
S().g()
S().f()
编译到.pyc:
λ> muridesu excuse_me.muridesu excuse_me.pyc
λ> python excuse_me.pyc
3
4
5
S
A
我们支持了什么呢?
请看muridesu.exrbnf.
语句:
importtry,except(这里改成了catch, 因为搞点新东西),finally.assertglobalnonlocalbreakcontinuewith,with A as B, ...for ... inclass Name <: Base1, Base2meta 你的Type构造器 class Name <: Base1, Base2return,return exprif- 函数定义
func(让我们学学木兰?) - 解构
(a, b, [c, d, (f, g, h)]) = ...
表达式:
- lambda:
fn args... -> expr, lambda 返回值可以是一个blockfn (x) -> { ...; return ...}. - bool表达式
and, or, not - 比较:
<, >, ...(Python所有的) - 二元运算(Python所有的, 懒得实现优先级了, 毕竟这只是个迫害项目)
- 单目运算(
-,~) yield,yield fromset,dict没有字面量, 但参考julia, 引入广泛可扩展的构造方式:set [1, 2, 3],dict [1 => 2, 2 => 3].- 其他的Python字面量, 除comprehensions
注: Python中的a[b]在muridesu中是a.[b], 因为我的想法是A[b, c, d]表示A_list([b, c, d]), A"string"表示A_str("string").
基本上接近Python的全集了.
所有说编译到Python AST真的是很简单的,不能让他骗经费是对的。
Python牛逼的编译器应该是这里这样的:
Metadata
Release files for muridesu 0.0.58
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| muridesu-0.0.58-py3-none-any.whl | Python 3 | none | any | Details |
Release files / muridesu-0.0.58-py3-none-any.whl
| Download URL | muridesu-0.0.58-py3-none-any.whl |
|---|---|
| Size | 28.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
63ae3c48ef78a5f644a30f41330c646fc7fce5480e8143bd0d5687abf4f47ed1
|
|
BLAKE2b-256 checksum How to use checksums |
b514c336909eba1c2b61c036bfba1e8ea249be2ecb004eff40fa021a3b8a4865
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.8.0 tqdm/4.36.1 CPython/3.7.4
|
Security for muridesu 0.0.58
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.