Law*_*ton 8 macos yacc bison flex-lexer shakespeare-lang
我想尝试使用莎士比亚编程语言,所以我从这里下载并使用Makefile执行cd spl-1.2.1 Make.
spl2c带有几个警告的执行汇编:
scanner.l:600: warning, rule cannot be matched
<stdout>:5808: warning: ‘yyunput’ defined but not used
Run Code Online (Sandbox Code Playgroud)
然后当它试图编译所有的例子时,一切都变得混乱:
../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.
Run Code Online (Sandbox Code Playgroud)
任何人都可以指出我正确的方向来解决这个问题吗?我原来的项目是学习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.
编辑:对于不需要gotos的简单程序(例如hello.spl),您可以通过删除除第一个ACT I/SCENE I之外的所有ACT/SCENE线来解决问题.
这个问题是由 2.5.4 和 2.5.33 版本之间引入的 Flex 中的一个错误引起的;也就是说,在编写莎士比亚处理器和提出这个问题之间的时间。该错误涉及在不区分大小写的正则表达式(例如i{1,3},这是 Shakespeare flex 罗马数字规范的一部分)中使用带单字符参数的花括号重复运算符;该错误的结果是不区分大小写的丢失,因此i{1,3}扩展为好像它[iI]i?i?代替了[iI][iI]?[iI]?. 这意味着将无法正确识别带有重复字符的大写罗马数字(这在莎士比亚源代码中很正常)。
Kyle Cartmell 在 Marlowe 中的更改在正则表达式中使用大写字母而不是小写字母,这颠倒了问题,以便只有大写罗马数字才能可靠地工作。
我将 Flex 错误报告为https://github.com/westes/flex/issues/193。如果有人在正式发布之前需要它,它是 Flex 的一个单行补丁。
| 归档时间: |
|
| 查看次数: |
6898 次 |
| 最近记录: |