構文解析の途中経過
途中経過書きます。
AST作ってトラバースできるようにしました。
文字列と変数の識別が実は入力で出来るように見せてるけど出来てない。つらい。
未実装内容は予約語(標準の関数)、ユーザ定義関数とか。
char_A // object_definition
{
prop_int: 10;
prop_exp: Identifier = 2*3*(3+4)<2*i-3;
prop_string: "hogehoge";
// prop_list: (1, 2, 3, "hoge", 2*3.14);
}
object_B
{
a:b;
c:d;
/*
this is hage code.
hage:hoge;
*/
// this is foo code.
foo1:fuga1;
foo2: fuga2;
foo3 : fooooooooo;
}
の入力に対して
以下のような、CSSとS式を組み合わせたような謎の出力がされる。
char_A
{
prop_int :
( 10, () )
prop_exp :
(=
( [Identifier], () )
,
(<
(*
(*
( 2, () )
,
( 3, () )
) // (*
,
(+
( 3, () )
,
( 4, () )
) // (+
) // (*
,
(-
(*
( 2, () )
,
( [i], () )
) // (*
,
( 3, () )
) // (-
) // (<
) // (=
prop_string :
( [hogehoge], () )
}
object_B
{
a :
( [b], () )
c :
( [d], () )
foo1 :
( [fuga1], () )
foo2 :
( [fuga2], () )
foo3 :
( [fooooooooo], () )
}