macos - 在Mac OS X 10.6上编译和执行莎士比亚编程语言转换器spl2c会导致警告/错误

标签 macos bison yacc flex-lexer shakespeare-lang

我想尝试Shakespeare programming language,所以我从here下载了它,并使用cd spl-1.2.1 Make执行了Makefile。

编译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.2gcc version 4.2.1 (Apple Inc. build 5646) (dot 1)flex 2.5.35bison (GNU Bison) 2.3

编辑:对于不需要gotos的简单程序(例如hello.spl),您可以通过删除除第一个ACT I/SCENE I之外的所有ACT/SCENE行来解决问题。

最佳答案

这是词法分析器中正则表达式的缺陷。

I forked the language.

I fixed the issue.

I notified the original authors.

Here's a release of the language that includes the fix for your enjoyment.

There are still a few warnings,但它们似乎没有任何影响。 Let me know,如果您发现任何其他功能问题,我将为您解决。

(Roffel-如果不是没有人关心这个问题的事实,这将是死法。)

关于macos - 在Mac OS X 10.6上编译和执行莎士比亚编程语言转换器spl2c会导致警告/错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1948372/

相关文章:

objective-c - 用于 Cocoa OS x 的语音到文本转录 API

ios - Xcode - 免费清除设备文件夹?

Unix 上的 Python::os.EX_NOTFOUND 的值

yacc - bison shift/reduce 问题将 add op 移动到 subexpr

parsing - 将错误产生式添加到语法中的策略是什么?

regex - 最好的现代文本解析? AKA 何时使用 Lex 和 Yacc?

c++ - 在 Mac OS X 上链接不同的 C++ 标准库

parsing - YACC/Bison中错误恢复产品的要求/限制是什么?

c - 如何在 YACC 语法中回显输入文本?