2

我试过一对。Google 中只有几个关于 re2c+lemon 的教程。
目前对于所有示例,我都会遇到类似的错误,例如:

In file included from main.cpp:2:0:
parser.y:44:5: error: ‘yygotominor’ was not declared in this scope
     A.int_value = B.int_value * C.int_value;
     ^
In file included from main.cpp:2:0:
parser.c:770:16: error: ‘YY_MAX_SHIFTREDUCE’ was not declared in this scope
   if( yyact <= YY_MAX_SHIFTREDUCE ){
                ^
parser.c:771:15: error: ‘YY_MAX_SHIFT’ was not declared in this scope
     if( yyact>YY_MAX_SHIFT ) yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
               ^

它在哪里声明?

PS:不要发布 10 年前的文章(即使没有代码或者现在无法编译代码)。如果可以的话 - 在这里写一个例子。如果不是 - 不要发布来自 Google 的链接。

4

1 回答 1

4

本教程适用于我:

  1. 获取 re2c(有关详细信息,请参阅 re2c 安装页面http://re2c.org/install/install.html)。

  2. 获取柠檬:下载 tarball wget http://prdownloads.sourceforge.net/souptonuts/lemon_examples.tar.gz,解压并构建(我不得不添加#include <stdlib.h>许多示例malloc)。

  3. 克隆 github 仓库https://github.com/tokuhirom/re2c-lemon-tutorialgit clone https://github.com/tokuhirom/re2c-lemon-tutorial.git

  4. 修补 re2c-lemon-tutorial/Makefile 以找到柠檬和 re2c(如果需要)。

  5. make./mycalc并享受(点击Ctrl+D停止并发出结果)。

re2c 网站上的更多 re2c 示例:http ://re2c.org ,柠檬 tarball 中的更多柠檬示例。

于 2016-03-25T23:24:32.653 回答