More Related Content
Similar to Pythonが動く仕組み(の概要)
Similar to Pythonが動く仕組み(の概要) (20)
Pythonが動く仕組み(の概要)
- 6. 字句解析器から構文解析器へのストリーム
字句解析器
(Lexer)
if 1 == 1 : <NEWLINE>
<INDENT> print ( "hello" <DEDENT> <NEWLINE>
構文解析器
(Parser)
if 1 == 1:
print("hello")
)
ポイントは論理的な字句である<INDENT>と<DEDENT>。
Pythonでは字句解析でインデントの始まりと終わりを作る。