理解Python中的AST 何翔宇3e340d762f6eb19e725/p1_2.jpg) ## 理解 Python 中的 AST 何翔宇(正小歪) 字节跳动·效率工程·后端开发工程师 ## 目录 Intro CPython's Compiler How to Use AST Library Use AST to Solve Problems Suggestion and Reference  从解析树中读取 - 根据转换规则 Parser/Python.asdl 使用 Python/python-ast.c 生成 AST - PyAST_CompileObject()、PySymtable_BuildObject()、compiler_mod() - 遍历 AST 各个节点创建符号表 - 交给一个巨大「switch」处理,创建0 码力 | 39 页 | 6.95 MB | 2 年前3
C++高性能并行编程与优化 - 课件 - 16 现代 CMake 模块化项目管理指南CMake # 现代 CMake 模块化项目管理指南 彭于斌 (@archibate) 课件 & 源码:https://github.com/parallel101/course 往期录播:https://space.bilibili.com/263032155 ## 第一章:文件 / 目录组织规范 基于 CMake 的 C/C++ 项目,如何优雅地、模块化地组织大量源文件? ## 推荐的目录组织方式 目录组织格式: • 项目名 /include/ 项目名 / 模块名 .h • 项目名 /src/ 模块名 .cpp • CMakeLists.txt 中写: • target include directories(项目名 PUBLIC include) • 源码文件中写: • #include < 项目名 / 模块名 .h> • 项目名:: 函数名 (); ## 推荐的目录组织方式 推荐的目录组织方式 - 头文件(项目名 /include/ 项目名 / 模块名 .h)中写: • #pragma once • namespace 项目名 { • void 函数名(); • } • 实现文件(项目名 /src/ 模块名 .cpp)中写: • #include < 项目名 / 模块名 .h> • namespace 项目名 { • void 函数名 () {0 码力 | 56 页 | 6.87 MB | 2 年前3
Pandoc User’s Guide (April 7, 2024)in a given format and produce a native representation of the document (an abstract syntax tree or AST), and a set of writers, which convert this native representation into a target format. Thus, adding only adding a reader or writer. Users can also run custom pandoc filters to modify the intermediate AST. Because pandoc’s intermediate representation of a document is less expressive than many of the formats notebook) • jats (JATS XML) • jira (Jira/Confluence wiki markup) • json (JSON version of native AST) • latex (LaTeX) • markdown (Pandoc's Markdown) • markdown_mmd (MultiMarkdown) • markdown_phpextra0 码力 | 168 页 | 475.29 KB | 2 年前3
Swift 写解释器 - 戴铭什么是解释器?什么是解析器?  源代码 一 编译 字节码|AST VM 解释执行 结果  工作流程0 码力 | 19 页 | 29.57 MB | 2 年前3
Go Compile Time Instrumentationlevel manipulation are part of standard library go/types go/constant go/parser go/ast go/scanner go/token ## Go AST Traversal func main() { // parse file fset := token.NewFileSet() node ParseComments) if err != nil { log.Fatal(err) } ast.Inspect(node, func(n ast.Node) bool { fn, ok := n.(*ast.FuncDecl) if ok { fmt.Printf(format: "function modifying it. It uses the AST (Abstract Syntax Tree) representation of the code to determine its operational flow and injects necessary OpenTelemetry functionality into the AST. The AST modification algorithm0 码力 | 27 页 | 1.74 MB | 1 年前3
How to Build Your First C++ Automated Refactoring Tool - CppCon 2023*Context) : ClangTidyCheck(Name, Context) {} void registerMatchers(ast_matchers::MatchFinder *Finder) override; void check(const ast_matchers::MatchFinder::MatchResult &Result) override;}; ![Ima *Context) : ClangTidyCheck(Name, Context) {} void registerMatchers(ast_matchers::MatchFinder *Finder) override; void check(const ast_matchers::MatchFinder::MatchResult &Result) override;}; ![Ima *Context) : ClangTidyCheck(Name, Context) {} void registerMatchers(ast_matchers::MatchFinder *Finder) override; void check(const ast_matchers::MatchFinder::MatchResult &Result) override;}; ![Ima0 码力 | 83 页 | 6.03 MB | 1 年前3
Programming TypeScript,转换成抽象句法树(abstract syntax tree, AS). AST 是去掉了空白、注释和缩进用的制表符或空格之后的数据结构。 编译器把 AST 转换成一种字节码(bytecode)的低(底?)层表示。 字节码再传给运行时程序计算,最终得到结果。 · 综上 1. 把程序解析成AST 2. 把 AST 编译成字节码 3. 运行时计算字节码 TS 的特殊之处在于,它不直接编译成字节码,而是编译成JS代码 的特殊之处在于,它不直接编译成字节码,而是编译成JS代码 • TS 1. TS 源码 => TS AST 2. 类型检查器检查 AST 3. TS AST => JS 源码 • JS 4. JS 源码 => JS AST 5. AST => 字节码 6. 运行时计算字节码 在这个过程中,第1-2步骤中使用程序的类型,第三步不使用。就是说 TS TS 编译成 JS 时,不会考类型。0 码力 | 3 页 | 202.08 KB | 2 年前3
2.1 gofmt 的文化演变但是,没有牛X的通用布局算法 • 相反的:基于节点的精细优化 ## 处理源代码 - 使用`go/scanner`, `go/parser`及其相关的库 给每一个go文件生成一个抽象语法树 - 每一个语法结构都有相应的AST节点 // Syntax of an if statement. If Stmt = "if" [ SimpleStmt ";" ] Expression Block condition Body *BlockStmt Else Stmt // else branch; or nil } • AST节点有(选择性的)位置信息。 ## 基本的格式化 - 遍历AST然后打印每个节点 case *ast.IfStmt: p.print(token.IF) p.controlClause(false, s.Init, s.Cond, p.print(blank, token.ELSE, blank) switch s.Else.(type) { case *ast.BlockStmt, *ast.IfStmt: p.stmt(s.Else, nextIsRBrace) default: p0 码力 | 34 页 | 9.97 MB | 2 年前3
A (Short) Tour of C++ Modules0 码力 | 62 页 | 4.20 MB | 1 年前3
httpd 2.4.16 中文文档编译与安装 启动 停止与重启 配置指令 指令快速参考 模块 多处理模块(MPM) 过滤器 处理器 表达式解析器 服务器与支持程序 术语 平台相关说明 Microsoft Windows Novell NetWare EBCDIC 系统 其它主题 常见问题 网站导航 开发文档 其它说明 维基 模块 | 指令 | 常见问题 | 术语 | 网站导航 Apache HTTP Apache > HTTP 服务器 > 文档 > 版本 2.4 ### Apache HTTP 服务器版本 2.4 ## 多处理模块(MPM) 此翻译可能过期。要了解最近的更改,请阅读英文版。 本文档介绍了什么是多处理模块,以及 Apache HTTP 服务器如何使用它们。 ## 介绍 Apache HTTP 服务器被设计为一个功能强大,并且灵活的 web 服务器,可以 Apache httpd 通过模块化的设计来适应各种环境。这种设计允许网站管理员通过在编译时或运行时,选择哪些模块将会加载在服务器中,来选择服务器特性。 Apache HTTP 服务器 2.0 扩展此模块化设计到最基本的 web 服务器功能。它提供了可以选择的多处理模块(MPM),用来绑定到网络端口上,接受请求,以及调度子进程处理请求。 扩展到这一级别的服务器模块化设计,带来两个重要的好处:0 码力 | 2438 页 | 1.87 MB | 1 年前3
共 1000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 100
相关搜索词
ASTast模块语法树节点遍历符号表CMake模块化项目管理语义版本号名字空间项目结构PandocMarkdownHaskellsandbox解释器解析器编译字节码OpenTelemetryGo compile-time instrumentationinstrumentationcontext propagationRefactoring Tooling Use CasesClangClang Tidy CheckAST MatchersLLVMTypeScript编译器抽象语法树(AST)类型检查器gofmt源代码格式化一致风格编程文化C++20模块模块化编译器支持模块接口过渡策略多处理模块(MPM)API变化新模块发行说明升级指南













