我正在尝试编写一个记号赋予器,但我得到了一个解析错误:
%*************************** parse error ************************
%**
%** syntax error, unexpected T_DEFAULT, expecting T_then
%**
%** in file "/Users/xxx/Programmering/Oz/Oving1/Oz_oving1_task8.oz", line 15, column 36
%** ------------------ rejected (1 error)下面是代码,我用%=ERROR=%标记了第15行和第36列
declare
fun {Tokenize L}
Keys Ops Token
in
Keys = ["local", "in", "if", "then", "else", "end"]
Ops = ["+", "-", "*", "/"]
case Tokenize of Head|Tail then
if {Member Head Keys} then
Token = key(Head)
elseif {Member Head Ops} then
Token = op(Head)
else
case Head of Forste|_ then
if Forste >= &a andthen Forste <= &z then % THIS IS LINE 15, COLUMN 36 = ..andthen [here]Forste..
Token = atom(Forste)
elseif
Forste >= &A andthen Forste <= &Z then
Token = id(Forste)
end
end
Token | {Tokenize Tail}
end
else
nil
end
end知道我做错了什么吗?
发布于 2010-09-07 18:21:38
我已经找到了解决方案:
在我的列表中,每个元素之间应该有空格而不是逗号(,)。
>= andthen =<而不是>= andthen <= ( =).
>在< case >d12上创建了一个代码,case应该在输入L.上
干杯!
https://stackoverflow.com/questions/3657621
复制相似问题