Nim 2.0.8 Manualinternal data structure called the abstract syntax tree (AST). Then, before executing the code or compiling it into the executable, it transforms the AST through semantic analysis. This adds semantic information custom numeric literal 123'custom is transformed to r"123". 'custom in the parsing step. There is no AST node kind that corresponds to this transformation. The transformation naturally handles the case that discardable pragma: however the discardable pragma does not work on templates as templates substitute the AST in place. For example: This template will resolve into "https://nim-lang.org (https://nim-lang.org)"0 码力 | 132 页 | 5.73 MB | 1 年前3
Computer Programming with the Nim Programming Language
Python- like (off- side rule) Native, web browser (JavaScript) GC, refcount, destructors Yes AST based, hygienic Yes Rust Imperative, procedural, structured, functional, object- oriented Static, strong, inferred Braces, semicolons Native Destructors, borrow- checker Yes AST based, hygienic Yes Language Paradigm Typing discipline Syntax Execution Memory Management Generics fashion; for example, instead of len(myStr), we can also use the OOP style myStr.len.[16] The powerful AST-based hygienic macro system offers nearly unlimited possibilities for the advanced programmer. This0 码力 | 865 页 | 7.45 MB | 1 年前3
Computer Programming with the Nim Programming Language
Python- like (off- side rule) Native, web browser (JavaScript) GC, refcount, destructors Yes AST based, hygienic Yes Rust Imperative, procedural, structured, functional, object- oriented Static, strong, inferred Braces, semicolons Native Destructors, borrow- checker Yes AST based, hygienic Yes Language Paradigm Typing discipline Syntax Execution Memory Management Generics fashion; for example, instead of len(myStr), we can also use the OOP style myStr.len.[16] The powerful AST-based hygienic macro system offers nearly unlimited possibilities for the advanced programmer. This0 码力 | 784 页 | 2.13 MB | 1 年前3
Nim 2.0.2 中文手册"运⾏ 时"涵盖了编译期执⾏和可执⾏⽂件的代码执⾏。 编译器将 Nim 源码解析成称为 abstract syntax tree (AST) "抽象语法树"的内部数据结构,在执⾏代码或将其编译为可执⾏⽂件之 前,通过 semantic analysis "语义分析"对AST进⾏转换,增加了语义信息,如表达式类型、标识符的含义,以及在某些情况下表达 式的值。在语义分析中检测到的错误被称为 static error 符串被传递给该标识符。可调⽤标识符需要⽤特定的 ' 前缀声明。 更确切地说,⾃定义的数值字⾯值 123'custom 在解析步骤中被转换为 r"123". 'custom 。并没有对应于这种转换的 AST 节点种 类。通过这种转换,在额外参数传递给被调⽤者时,处理更合理。 echo -1 echo(-1) echo [-1] echo 3,-1 "abc";-1 echo x-1 echo 忽略过程的返回值⽽不使⽤丢弃语句将是静态错误。 如果调⽤的 proc/iterator 已使⽤ discardable "可丢弃"编译指示声明,则可以隐式忽略返回值: 但是可丢弃编译指示不适⽤于模板,因为模板会替换掉 AST。 例如: 此模板将解析为字符串字⾯值 "https://nim-lang.org (https://nim-lang.org)" ,但由于 {.discardable.} 不适⽤于字⾯值,编译器会出0 码力 | 127 页 | 7.05 MB | 1 年前3
Computer Programming with the Nim Programming Languagedo: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398 Building the AST manually . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . like (off- side rule) Native, web browser (JavaScri pt) GC, ref count, destruc tors Yes AST based, hygienic Yes 25 Lan guage Para digm Typing disci pline Syntax Execu tion Memory Static, strong, inferred Braces, semi colons Native Destruc tors, bor row- checker Yes AST based, hygienic Yes D Impera tive, pro cedural, struc tured, func tional, object- oriented0 码力 | 512 页 | 3.54 MB | 1 年前3
Computer Programming with the Nim Programming Languagequote do: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 Building the AST manually. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . like (off- side rule) Native, web browser (JavaScrip t) GC, ref count, destruc tors Yes AST based, hygienic Yes Rust Impera tive, pro cedural, struc tured, func tional, object-ori Static, strong, inferred Braces, semi colons Native Destruc tors, bor row- checker Yes AST based, hygienic Yes 25 Lan guage Para digm Typing discipline Syntax Execu tion Memory0 码力 | 508 页 | 3.50 MB | 1 年前3
Computer Programming with the Nim Programming Languagedo: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398 Building the AST manually . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . like (off- side rule) Native, web browser (JavaScri pt) GC, ref count, destruc tors Yes AST based, hygienic Yes 25 Lan guage Para digm Typing disci pline Syntax Execu tion Memory Static, strong, inferred Braces, semi colons Native Destruc tors, bor row- checker Yes AST based, hygienic Yes D Impera tive, pro cedural, struc tured, func tional, object- oriented0 码力 | 512 页 | 3.53 MB | 1 年前3
Computer Programming with the Nim Programming Languagequote do: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 Building the AST manually. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . like (off- side rule) Native, web browser (JavaScrip t) GC, ref count, destruc tors Yes AST based, hygienic Yes Rust Impera tive, pro cedural, struc tured, func tional, object-ori Static, strong, inferred Braces, semi colons Native Destruc tors, bor row- checker Yes AST based, hygienic Yes 25 Lan guage Para digm Typing discipline Syntax Execu tion Memory0 码力 | 508 页 | 3.54 MB | 1 年前3
Computer Programming with the Nim Programming Languagequote do: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 Building the AST manually. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . like (off- side rule) Native, web browser (JavaScrip t) GC, ref count, destruc tors Yes AST based, hygienic Yes Rust Impera tive, pro cedural, struc tured, func tional, object-ori Static, strong, inferred Braces, semi colons Native Destruc tors, bor row- checker Yes AST based, hygienic Yes 25 Lan guage Para digm Typing discipline Syntax Execu tion Memory0 码力 | 508 页 | 3.50 MB | 1 年前3
Computer Programming with the Nim Programming Languagequote do: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 Building the AST manually. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . like (off- side rule) Native, web browser (JavaScrip t) GC, ref count, destruc tors Yes AST based, hygienic Yes Rust Impera tive, pro cedural, struc tured, func tional, object-ori Static, strong, inferred Braces, semi colons Native Destruc tors, bor row- checker Yes AST based, hygienic Yes 25 Lan guage Para digm Typing discipline Syntax Execu tion Memory0 码力 | 508 页 | 3.52 MB | 1 年前3
共 32 条
- 1
- 2
- 3
- 4













