1.文法
描述语言的语法结构的形式规则
为对文法进行形式化描述,提出一些基本概念:
V*与V+:如果V中原来没有空字,闭包中会包含空字,而正规闭包之中不会包含空字,其他情况下二者相同
上下文无关文法
文法生成语言
从句子到最后的句子,每一步都是直接推出
练习题:
1.
2.
3.
4.
5.
推导与语法树
最左推导与最右推导
不管那种推导,树的结构都是一样的。语法树不能表明生成顺序
语法树与二义性
in a boat 可以修饰动词saw,也可以修饰Mary
形式语言鸟瞰
类型差别就在于P的不同
处理不了的,使用语义分析来做。