扩展Python代码-添加语言功能 [英] Extending the code of Python - adding language features

查看:76
本文介绍了扩展Python代码-添加语言功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我专门从事python编程已有4年了,从来没有真正看过编写python的C代码。我最近研究问题,该问题涉及在该级别修改python。

I have been programming in python exclusively for 4 years and have never really looked under the hood at the C code in which python is written. I have recently been looking into a problem that would involve modifying python at that level.

代码看起来很一致,因此相对容易理解。但是,它是如此复杂,以至于仅仅研究它如何协同工作对我来说就没有意义。当然,我并不需要花费很多时间或精力,因为需要更好的资源。我还查看了 the 文档。但是,它更倾向于通过模块扩展语言。

The code seems pretty consistent, and thus relatively easily understood. However, it's complex enough that it wasn't making sense to me just by studying it how it all worked together. Granted, I didn't spend a lot of time or effort on that, for want of a better resource. I also looked over the documentation on the python site. However, it is oriented more toward extending the language through modules.

我希望找到一些简单的文档,说明解析器如何在C级别工作以及如何扩展C语言。直接使用核心语言(添加语言功能)。面向模块的文档提供了有关构建类型和管理对象的方式的深刻见解,但我还在寻找更多。

I was hoping to find some straightforward documentation on how the parser works at the C level and how to extend the core language directly (adding language features). The module-oriented documentation provides some great insight into the way types are built and objects are managed, but I am looking for more.

那里有这样的文档吗?

Is there any such documentation out there?

推荐答案

本文可能会帮助您入门。它从出色的 PEP 339-CPython编译器的设计中获取了大量信息。 a>。

This article may help you get started. It takes a lot of information from the excellent PEP 339 - Design of the CPython Compiler.

这篇关于扩展Python代码-添加语言功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆