I've tried a couple. And there is only a couple of tutorials in Google for re2c+lemon.
Currently for all examples I get similar bunch of errors like:
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;
^
Where is it declared?
PS: don't post 10y old articles (even without code or if the code can't be compiled now). If you can - write an example here. If not - don't post links from Google.
This tutorial works for me:
Get re2c (see re2c install page for details http://re2c.org/install/install.html).
Get lemon: download tarball wget http://prdownloads.sourceforge.net/souptonuts/lemon_examples.tar.gz
, extract and build (I had to add #include <stdlib.h>
to many examples for malloc
).
Clone github repo https://github.com/tokuhirom/re2c-lemon-tutorial : git clone https://github.com/tokuhirom/re2c-lemon-tutorial.git
Patch re2c-lemon-tutorial/Makefile to find lemon and re2c (if needed).
make
, ./mycalc
and enjoy (hit Ctrl+D
to stop and emit result).
More re2c examples on re2c website: http://re2c.org, more lemon examples inside of lemon tarball.