乔姆斯基在研究语言的过程中,从产生语言的角度发现了一种模型用来描述语言,它就是文法。
文本格式化
normal, italic, bold, mono.
``double quoted'', `single quoted'.
normal, super, sub.
Command: ls -al
mono *bold*
passthru bold
Path: '/some/filez.txt', '.b'
red text on yellow large all bold
aqua aqua-background black black-background blue blue-background fuchsia fuchsia-background gray gray-background green green-background lime lime-background maroon maroon-background olive olive-background purple purple-background red red-background silver silver-background teal teal-background white white-background yellow yellow-background
Chars: nibmr
Escaped: _italic_, _italic_, t__e__st, t__e__st, bold, <b>normal</b> ¶ `not single quoted' \`\`not double quoted''
段落
在研究语言的过程中,我们往往需要判断一个字符串是否属于某个语言。 如果这个的语言是一个有穷集合那还好说,我们只需要遍历语言中的所有字符串就能判断出我们要找的字符串是不是属于该语言。 但当语言是一个无穷集合时,事情就会变得比较棘手。 幸运的是,一般来说语言都有一个自己的结构,称为语法。 通过一个适当的模型,我们就能表打出语言的结构特征,而这个模型就是文法。
有了文法之后,我们就可以用一个有穷描述来描述语言,文法解决了语言的定义问题(从另一种角度定义无穷字符串集合)。
用文法不仅能描述出语言的结构特征,还能生成该语言的所有句子。 用文法生成的集合就是它所描述的语言。 但是,文法也有自己的能力上限,不是所有的语言都可以用文法来描述。 正则文法那一部分我们就能监视到。
多级标题
三级 1
四级1
三级2
四级2
样例块
This is an example single-paragraph note. very very very very very very very very very very very very very very very very very very very very very very very long.
This is the second paragraph.
结束测试。
补充块
警告块
Note. |
Tip. |
Important. |
Caution. |
Warning. |
这是一个 1 倍大小的 爱心。 这是一个 2 倍大小的 爱心。
Feeding the Werewolves While werewolves are hardy community members, keep in mind the following dietary concerns:
|
代码块
<style>
pre.rouge .hll {
background-color: #ffc;
}
pre.rouge .hll * {
background-color: initial;
}
</style>
代码块间距测试。
require 'sinatra' (1)
get '/hi' do (2) (3)
"Hello World! very very very very very very very very very very very very very very very very very very very very very very very long."
end
1 | Library import |
2 | URL mapping |
3 | Response block |
这是一个块内代码 GetUrl(http://test.com)
测试。
gist 测试。
直译块
*Literal* Block Use: workaround when literal paragraph (indented) like 1. First. 2. Second. incorrectly processed as list.
引用块
Quote Block
Use: cite somebody
cite source
Quote Block
Use: cite somebody "Hello World! very very very very very very very very very very very very very very very very very very very very very very very long."
cite source
折叠块
链路层和网络层信息收集
折叠块测试。
概要:监听能捕获的网络段和 IP,同时记录下各个 IP 开启的服务(如 ICMP、HTTP)。
工具:
参考文献:
概要:监听周围设备的信道、加密方式、SSID、BSSID、ESSID。
工具:
参考文献:
测试结束。
图片
接下来看一个标题测试:
测试完毕。 可以发现撒旦恢复本年度送我在那些佛埃及访问。额外惊人之举欧文二日而我却将
列表
bullet
bullet
bullet
bullet
bullet
bullet
bullet
bullet
bullet
bullet
bullet
bullet
bullet
bullet
bullet
bullet
bullet
列表继续的测试:
test
this is a test
test
this is a test
this is a test
test
test
bullet
bullet
段落后接列表测试:
number
number
letter
letter
number
loweralpha
loweralpha
lowerroman
lowerroman
upperalpha
upperalpha
upperroman
upperroman
upperalpha
lowerroman
loweralpha
number
letter
letter
letter2
letter2
number
number
number2
number2
number2
number2
number
letter2
letter
checked
also checked
not checked
normal list item
checked
also checked
not checked
normal list item
- Term 1
Definition 1
- Term 2
Definition 2
- Term 2.1
Definition 2.1
- Term 2.2
Definition 2.2
- Term 3
Definition 3
- Term 4
Definition 4
- Term 4.1
Definition 4.1
- Term 4.2
Definition 4.2
- Term 4.2.1
Definition 4.2.1
- Term 4.2.2
Definition 4.2.2
- Term 4.3
Definition 4.3
- Term 5
Definition 5
- Term 1
Definition 1
- Term 1.1
Definition 1.1
Term 1 | Definition 1 |
Term 2 | Definition 2 |
Term 2.1 | Definition 2.1 |
Term 2.2 | Definition 2.2
|
Term 4.1 | Definition 4.1 |
Term 4.2 | Definition 4.2 |
Term 4.2.1 | Definition 4.2.1 |
Term 4.2.2 | Definition 4.2.2
|
Question 1
Answer 1
Question 2
Answer 2
bullet
another bullet
number
again number
letter
again letter
letter
number
bullet
bullet
number
number
Independent paragraph break list.
number
number
List block define list boundary too
number
number
number
number
bullet continuation
number continuation
bullet
literal continuation
letter
Non-literal continuation.
any block can be included in list
Last continuation.
bullet
bullet
bullet
bullet
bullet
bullet
number
letter
number
letter
letter
number
表格
Col 1 | Col 2 | Col 3 |
---|---|---|
1 | Item 1 | a |
2 | Item 2 | b |
3 | Item 3 | c |
6 | Three items | d |
1 | 2 | 3 | 4 |
a | b | c | d |
A | B | C | D |
ID | FName | LName | Address | Phone |
---|---|---|---|---|
1 | Vasya | Pupkin | London |
|
2 | X | Y | A,B |
|
Date | Duration | Avg HR | Notes |
---|---|---|---|
22-Aug-08 | 10:24 | 157 | Worked out MSHR (max sustainable heart rate) by going hard for this interval. |
22-Aug-08 | 152 | Back-to-back with previous interval. | |
24-Aug-08 | none |
数学公式
构造产生语言 \${a^nb^nc^n| n>=1}\$ 的文法。
解:这个语言实际上是一个上下文有关语言 CSL,它不能用上下文无关文法表示。 如果将 \$a^nb^n\$ 和 \$c^n\$ 分开表示,即构造文法如下:
\$A->aAb|ab\$
\$B->cB|c\$
则它只能表示语言 \${a^nb^nc^m|n>=1,m>=1}\$,因为不在同一产生式的递归推导终结符,无法保证终结符的个数相同。 只有递归表示位于同一产生式中,才能保证该产生式中的符号是同个数的。 因此可以考虑将语言分成三部分:
这样 a、B、C 出现的个数相同,可惜此字符串是以 \$aa cdots a BCBC cdots BC\$ 形式出现的,因此我们需要添加产生式,调整非终结符的顺序:
这样既不改变 B 和 C 的数量,同时也把 C 都移到了最右边。
最后,只有处于正确位置的 B、C 才能推导为终结符:
\$bB->b b\$
\$bC->bc\$
\$cC->c c\$
这保证了 aBCBC 在不换位直接推导的时候会碰到 cB,进而无法推导下去。