理解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
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;};  : ClangTidyCheck(Name, Context) {} void registerMatchers(ast_matchers::MatchFinder *Finder) override; void check(const ast_matchers::MatchFinder::MatchResult &Result) override;};  : ClangTidyCheck(Name, Context) {} void registerMatchers(ast_matchers::MatchFinder *Finder) override; void check(const ast_matchers::MatchFinder::MatchResult &Result) override;};  a message coming off the wire. • The role of Boolean algebra in composing matchers. • Understanding Boolean implication and using it to simplify matchers. This talk is a series compile time (given that storage is statically known). ## Part 2 Matching on fields in a message. ## Matchers To determine the correct message type for data arrived off the wire, we use a matcher. 1: template Value> 6: 7: // etc... ## Matchers are Boolean values We can treat a function that returns a bool just like a bool. (They're0 码力 | 103 页 | 4.37 MB | 1 年前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
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
2020: The Year of Sanitizers?Checks can plug into the analysis on the preprocessor level using PPCallbacks or on the AST level using AST Matchers ## clang-tidy Checks are organized in modules, which can be linked into clang-tidy with Checks can plug into the analysis on the preprocessor level using PPCallbacks or on the AST level using AST Matchers Checks can report issues in a similar way to how Clang diagnostics work. A fix-it hint0 码力 | 135 页 | 27.77 MB | 1 年前3
Computer Programming with the Nim Programming Languageand the quote do: construct 393 The genast() macro as a replacement for quote do: 395 Building the AST manually 395 The assert macro 400 Pragma macros 402 Pragma macros for iterators 403 Macros for destructors|Yes|AST based, hygienic|Yes| |Rust|Imperative, procedural, structured, functional, object-oriented|Static, strong, inferred|Braces, semi-colons|Native|Destructors, borrow-checker|Yes|AST based, hygienic|Yes| for example, instead of len(myStr), we can also use the OOP style myStr.len. $ ^{[2]} $ The powerful AST-based hygienic macro system offers nearly unlimited possibilities for the advanced programmer. This0 码力 | 508 页 | 3.53 MB | 1 年前3
Computer Programming with the Nim Programming Languagedo: construct ..... 396 The genast() macro as a replacement for quote do: ..... 398 Building the AST manually ..... 398 The assert macro ..... 403 Pragma macros ..... 405 Pragma macros for iterators inferred|Python-like (off-side rule)|Native, web browser (JavaScript)|GC, ref-count, destructors|Yes|AST based, hygienic|Yes| |Language|Para-digm|Typing discipline|Syntax|Execution|Memory Management|Generics|Macro object-oriented|Static, strong, inferred|Braces, semi-colons|Native|Destructors, borrow-checker|Yes|AST based, hygienic|Yes| |D|Imperative, procedural, structured, functional, object-oriented|Static, strong0 码力 | 512 页 | 3.53 MB | 1 年前3
Computer Programming with the Nim Programming Languagedo: construct ..... 396 The genast() macro as a replacement for quote do: ..... 398 Building the AST manually ..... 398 The assert macro ..... 403 Pragma macros ..... 405 Pragma macros for iterators inferred|Python-like (off-side rule)|Native, web browser (JavaScript)|GC, ref-count, destructors|Yes|AST based, hygienic|Yes| |Language|Para-digm|Typing discipline|Syntax|Execution|Memory Management|Generics|Macro object-oriented|Static, strong, inferred|Braces, semi-colons|Native|Destructors, borrow-checker|Yes|AST based, hygienic|Yes| |D|Imperative, procedural, structured, functional, object-oriented|Static, strong0 码力 | 512 页 | 3.50 MB | 1 年前3
共 867 条
- 1
- 2
- 3
- 4
- 5
- 6
- 87
相关搜索词
ASTast模块语法树节点遍历符号表Refactoring Tooling Use CasesClangClang Tidy CheckAST MatchersLLVMBoolean algebramessage handlingmatchersexpression templatesconstraint expressions解释器解析器编译字节码OpenTelemetryGo compile-time instrumentationinstrumentationcontext propagationTypeScript编译器抽象语法树(AST)类型检查器sanitizersAddressSanitizerClang-tidyVisual StudioNim编程语言模块化结构异步操作内存安全面向对象编程模块概念垃圾回收工具支持语言特点学习资源编程教育













