Flex/Bison:构建示例项目以生成 CPP 时出错
Flex/Bison: Error when building a sample project to generate Cpp
我正在尝试使用flex和bison生成Cpp(不是C(。我从GitHub(https://github.com/ezaquarii/bison-flex-cpp-example(获得了一个示例代码并尝试构建它。
这是生成文件内容
all:
flex -o scanner.cpp scanner.l
bison -o parser.cpp parser.y
g++ -g main.cpp scanner.cpp parser.cpp interpreter.cpp command.cpp -o a.out
clean:
rm -rf scanner.cpp
rm -rf parser.cpp parser.hpp location.hh position.hh stack.hh
rm -rf a.out
当我运行命令制作时,出现以下错误
flex -o scanner.cpp scanner.l
bison -o parser.cpp parser.y
"parser.y", line 29: junk after `%%' in definition section
Makefile:2: recipe for target 'all' failed
make: *** [all] Segmentation fault
这是我的野牛版本(Linux操作系统(
bison --version
bison++ Version 1.21.9-1, adapted from GNU bison by coetmeur@icdc.fr
Maintained by Magnus Ekdahl <magnus@debian.org>
有人可以告诉我出了什么问题吗?
我更新了我的野牛版本。
bison --version
bison (GNU Bison) 3.0.4
Written by Robert Corbett and Richard Stallman.
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@user6556709,感谢您的修复。
相关文章:
- C++-试图将函数指针推回到另一个CPP文件中的矢量时出错
- .h 和.cpp文件分离时出错,但仅使用 .h 文件时没有错误.我做错了什么?
- 创建 OpenCV 非自由版本 v4.3 时出错,可折叠.cpp错误 C2039、2605
- 编译时出错 - 链接.cpp和头文件
- LNK2019 在文件中调用静态成员的方法时出错.cpp
- ASIOSDK;从hostsample.cpp生成mex文件时出错
- Flex/Bison:构建示例项目以生成 CPP 时出错
- 将节点 js 代码集成到 cpp 库时出错
- 快速傅立叶变换:使用模板化派生类'undefined reference'即使标头和.cpp文件匹配也会出错
- 编译 .cu 与 .cpp:即使没有任何 CUDA 代码,编译器也会出错
- 编译 CPP 应用程序时出错。 "error: 'posix_memalign' was not declared in this scope"
- 使用 delete[] cpp 时出错
- 将 Boost 标头包含在 .h 文件中但不包含在.cpp文件中时出错
- 使用 G++ 在终端中运行.cpp文件时出错
- 使用stat和read()读取cpp文件时出错
- 编译php-cpp main.cpp文件时出错
- main.cpp|15|错误:从 'const char*' 到 'char' 的转换无效 [-允许]|制作游戏时出错
- 编译 cpp-netlib 源代码时出错
- 为我的生成文件运行时出错.cpp
- 在尝试运行文件时,yaml-cpp出错