Lexical, Syntax & Semantic Analysis

Requirements:
# 保留字或運算子:begin, for, end, if, then, else, while, int
# 運算子:+, -, *, /, =
# 判斷子:<, >, <=, >=, ==, and, or
# 若有詞法或語法錯誤,請印出並說明
# 請印出所有變數最後的狀態
# 自定義文法,使得以下範例成立:

begin
    int x=0, zzz=5;
    int i, j=1;
    # 進行迴圈
    for, i=1, i<=50, j; # j爲i每次遞增的值
        x=x+1;
    end
    if ((x>5) and (j<=8)) then
        x=1;
    else
        for, i=1, i<=50, j+1;
            x=x+1;
        end
        while (i<11)
            yy=x;
            i=i+1;
        end
    end
end
      
Source Code:

Console:

        
{{ v }}: {{ vars[i] }}

{{ l }}