[問題] 關於compiler的語彙分析(lexical analysis)
compiler的
語彙分析(lexical analysis)、
語法分析(syntax analusis)、
語意分析(semantic analysis)
這三個階段以前學校老師說是平台獨立
不過最近在網路看到某投影片寫
"關於將語彙分析語語法分析分開的理由"有三點:
Simplicity (簡單)
Less complex approaches can be used for lexical analysis; separating them
simplifies the parser
Efficiency (效率)
Separation allows optimization of the lexical analyzer
Portability (可攜)
Parts of the lexical analyzer is somewhat platform-dependent, but
the syntax analyzer can be platform-independent (平台獨立)
在可攜性那像寫說lexical analyzer有時跟平台有關,
這樣compiler不就跟平台也有關了嗎?
有點困惑? 希望有人可以給我點意見, 謝謝!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.27.36.153
※ huiming:轉錄至看板 C_and_CPP 03/12 09:58
Programming 近期熱門文章
PTT數位生活區 即時熱門文章