ぱたへね

はてなダイアリーはrustの色分けができないのでこっちに来た

Writing Compilers and Interpreters: その12

定数宣言のパースができるようになった。こういう定数の宣言をパースしてクロスリファレンスをかえると、

CONST
    epsilon = 10;
    limit = -epsilon;
BEGIN
END.

こんな感じで、integerということとその値が表示されるところまで来た。

***Definition.PROGRAM dummy_program_name ***

Identifier        Line numbers   
----------        ----------- 
epsilon         002 003 
                                Defined as: 1
                                scope nesting level: 1
                                Type form = 0, type id = integer
                                Value = 10
limit           003 
                                Defined as: 1
                                scope nesting level: 1
                                Type form = 0, type id = integer
                                Value = -10
				

少しずつ前へ。