我想尝试使用莎士比亚编程语言,所以我从这里下载并使用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 …Run Code Online (Sandbox Code Playgroud) 我查看了几部莎士比亚的文件,但我无法弄清楚如何使我的莎士比亚计划有效.
我尝试过以下方法:
Shakespeare, A Program.
Romeo, A young man.
Juliet, a young woman
Act I: A test of variables.
Scene I: The first scene.
[Enter Romeo and Juliet]
Hamlet: You are as stupid as a smelly big flower!
Run Code Online (Sandbox Code Playgroud)
(这应该将朱丽叶设为4,因为臭臭=*2,大=*2,花= 1)
Juliet: Proceed to Scene II.
[Exeunt]
Scene I: The second scene.
[Enter Romeo and Juliet]
Juliet: Am I better than you?
Romeo: If so, you are as intelligent as the square root of Juliet.
Romeo: Open your heart.
Run Code Online (Sandbox Code Playgroud)
这应该返回2,这是朱丽叶的价值.不幸的是,这只会给编译器错误.我究竟做错了什么?
今天在浏览Code Golf时,我发现了一种基于莎士比亚的语言,称为莎士比亚编程语言(SPL)。
在尝试了解该语言的工作原理时,我遇到了SPL 的维基百科条目,其中包括“标准‘Hello World’程序”的示例代码,并且我很难理解该代码的工作原理。
莎士比亚编程语言中的这段代码如何打印“Hello World”?
Romeo, a young man with a remarkable patience.
Juliet, a likewise young woman of remarkable grace.
Ophelia, a remarkable woman much in dispute with Hamlet.
Hamlet, the flatterer of Andersen Insulting A/S.
Act I: Hamlet's insults and flattery.
Scene I: The insulting of Romeo.
[Enter Hamlet and Romeo]
Hamlet:
You lying stupid fatherless big smelly half-witted coward! You are as
stupid as the difference between a handsome …Run Code Online (Sandbox Code Playgroud)