当前位置: 首页 > news >正文

《CPython Internals》阅读笔记:p118-p150

《CPython Internals》学习第 8 天,p118-p150 总结,总计 33 页。

一、技术总结

补充一些本人整理的关于 Context-Free Grammar(CFG) 的知识。

1.symbol(符号)

A mathematical symbol is a figure or a combination of figures that is used to represent a mathematical object(符号是一个数字或数字的组合,用来表示一个数学对象)。

symbols也称为character(字符), letter(字母),范围比较广,可以是 deciamal digits(十进制数,0,1,2,3,4,5,6,7,8,9), 也可以是letters(a,…,z, A,…,Z),还可以是 >, <, =, !等。

2.alphabet(字母表)

2.1.定义

An alphabet is a finite, nonempty set of symbols. Conventionally, we use the symbol ∑(sigma) for an alphabet.

2.2.示例

{0, 1},{a, …, z}。

3.string(串)

3.1. 定义

A string (or sometimes 01ì) is a finite sequence of symbols chosen from some alphabet.

3.2. 示例

For example, 01101 is a string from the binary alphabet Σ = {0, 1}. The string 111 is another string chosen from this alphabet.

3.3.empty string(空串)

The empty string is the string with zero occurrences of symbols. This string, denoted ϵ, is a string that may be chosen from any alphabet whatsoever.

3.4. length of string

4.language(语言)

4.1. 定义

A set of strings all of which are chosen from some alphabet, where Σ is a particular alphabet, is called a language.

注:language 是 string 的集合。

4.2. 示例

{10, 11, 101, 111, 1011,…}

5. grammar(文法)

全称为 Context-Free grammar(上下文无关文法),简写为grammar(文法)。

G=(V, T, P, S)

注:G 是 grammar 的首字母。(V, T, P, S)称为四元组(及有四个元素的元组)。集合里面的元素是无序的,元组里面的元素是有序的——示例: {1, 2, 3, 4} 和 {4, 3, 2, 1}可以是相等的,但是 (V, T, P, S) 和 (S, P, T, V)是不相等的,因为顺序不一样。

5.1. V

V is a finite set of variables, also called sometimes nonterminals(非终结符) or syntactic categories(语法范畴).

5.2. T

T is a finite set of symbols that form the strings of the language being defined. We call this alphabet the terminals(终结符), or terminal symbols(终结符号).

5.3. P

P is a finite set of productions(产生式) or rules that represent the recursive definition of a language.

There is a finite set of productions or rules that represent the recursive definition of a language. Each production consists of:

(a) A variable that is being (partially) defined by the production. This variable is often called the head of the- production.

(b) The production symbol →.

© A string of zero or more terminals and variables. This string, called the body of the production, represents one way to form strings in the language of the variable of the head. In so doing, we leave terminals unchanged and substitute for each variable of the body any string that is known to be in the language of that variable.

5.4. S

One of the variables represents the language being defined; it is called the start symbol(开始符号).

二、英语总结(生词:0)

无。

关于英语的注解同步更新汇总到 https://github.com/codists/English-In-CS-Books 仓库。

三、其它

The Compiler章节简评:今日不想评。

四、参考资料

1. 编程

(1) Anthony Shaw,《CPython Internals》:https://book.douban.com/subject/35405785/

2. 英语

(1) Etymology Dictionary:https://www.etymonline.com

(2) Cambridge Dictionary:https://dictionary.cambridge.org

欢迎搜索及关注:编程人(a_codists)

http://www.lryc.cn/news/520661.html

相关文章:

  • C/C++ 数据结构与算法【排序】 常见7大排序详细解析【日常学习,考研必备】带图+详细代码
  • 三只松鼠携手爱零食,社区零售新高峰拔地而起
  • Java聊天小程序
  • Kibana操作ES基础
  • MYSQL8创建新用户报错:You have an error in your SQL syntax;check...
  • 动漫周边商城系统|Java|SSM|VUE| 前后端分离
  • Vue 3 Diff 算法受 `v-for` 循环中的 `key` 属性影响
  • 江科大STM32入门——看门狗笔记整理
  • 【计算机网络】lab7 TCP协议
  • 计算机视觉:解锁未来智能世界的钥匙
  • Java的Stream流和Option类
  • 深入理解ASP.NET Core 管道的工作原理
  • 多模态论文笔记——CLIP
  • brpc之baidu_protocol
  • LeetCode:39. 组合总和
  • SOLID原则学习,开闭原则(Open Closed Principle, OCP)
  • Unreal Engine 5 C++ Advanced Action RPG 七章笔记
  • 自动连接校园网wifi脚本实践(自动网页认证)
  • HTTP/HTTPS ⑤-CA证书 || 中间人攻击 || SSL/TLS
  • traceroute原理探究
  • 50_Lua垃圾回收
  • Git-2-:Cherry-Pick 的使用场景及使用流程
  • 【C++】21.map和set的使用
  • burpsiute的基础使用(2)
  • ElasticSearch 同义词匹配
  • linux RT-Preempt spin lock实现
  • PySpark广播表连接解决数据倾斜的完整案例
  • Chromium CDP 开发(十二):为自己的Domain建立custom_config.json
  • 【Vue】全局/局部组件使用流程(Vue2为例)
  • Vue.js组件开发详解