解析
From Wikipedia, the free encyclopedia
電算同語言學入面,解析(英文:parsing[註 1],又叫 syntactic analysis )係指分析一串語言資訊,決定佢喺某種形式語法(英文:formal grammar)(formal grammar)中嘅語法結構(grammatical structure)嘅過程。
呢篇文或者呢段要 翻譯(或者由 en:parsing加料)。 |
![](http://upload.wikimedia.org/wikipedia/commons/thumb/d/db/Parsing-example.png/320px-Parsing-example.png)
喺電算,上面講嘅語言資訊並唔係源碼,而係一種叫 token(臺譯 「符記」)嘅數據,token 係已經用掃描器(scanner,又叫 lexer)將原碼掃咗一次,而得出嘅識別碼、保留字、字串、數字或者其他符號,而解析就係指將 token 重新組合成一種對應原內容語法結構嘅數據結構,方便以後處理,用嘅數據結構通常會係一棵樹,叫解析樹(parse tree),而做呢樣嘢嘅嘢就叫解析器(parser)。
下面段文未譯好,歡迎你幫手。
Parsing is also an earlier term for the diagramming of sentences of natural languages, and is still used for the diagramming of inflected languages, such as the Roman languages or Latin.
There are tools, called parser generators, that can automatically generate a parser (in some programming language) from a grammar written in Backus-Naur form (e.g. Yacc - yet another compiler compiler).