我想尝试使用莎士比亚编程语言,所以我从这里下载了它并使用cd spl-1.2.1
Make
.
编译spl2c
执行时有几个警告:
scanner.l:600: warning, rule cannot be matched
<stdout>:5808: warning: ‘yyunput’ defined but not used
然后,当它尝试编译所有示例时,一切都变得混乱:
../spl/bin/spl2c < fibonacci.spl > fibonacci.c
Warning at line 19: equality expected
Warning at line 28: equality expected
Warning at line 30: comment expected
Warning at line 30: comment expected
Warning at line 30: comment expected
Warning at line 30: comment expected
Warning at line 32: comment expected
Warning at line 32: comment expected
Warning at line 32: comment expected
Warning at line 32: comment expected
Warning at line 34: comment expected
Warning at line 34: comment expected
Warning at line 34: comment expected
Warning at line 34: comment expected
Warning at line 36: comment expected
Warning at line 36: comment expected
Warning at line 37: comment expected
Warning at line 37: comment expected
Warning at line 37: comment expected
Warning at line 37: colon expected
Warning at line 40: equality expected
Warning at line 51: comment expected
Warning at line 51: comment expected
Warning at line 51: comment expected
Warning at line 51: comment expected
Warning at line 51: comment expected
Warning at line 51: colon expected
Error at line 59: 'act [roman number]' or 'scene [roman number]' expected
1 errors and 27 warnings found. No code output.
有人能指出我解决这个问题的正确方向吗?我最初的项目将学习 spl,而不是倾向于调试编译器(我实际上最终想编写自己的编译器,但我现在更愿意坚持我的初始项目)。
我在跑步OS X 10.6.2
,,,,gcc version 4.2.1 (Apple Inc. build 5646) (dot 1)
和flex 2.5.35
。bison (GNU Bison) 2.3
编辑:对于不需要 goto 的简单程序(例如 hello.spl),您可以通过删除除第一个 ACT I/SCENE I 之外的所有 ACT/SCENE 行来解决此问题。