用Lex(flex)和yacc(bison)写的简单计算器Lex文件如下: %{#include "cal.tab.h"%}%option noyywrapinteger [0-9]+dreal ([0-9]*"."[0-9]+)ereal ([0-9]*"."[0-9]+[EedD][+-]?[0-9]+)real {dreal}|{ereal}nl /nplus "+"minus "-"t
Lex文件如下: %{#include "cal.tab.h"%}%option noyywrapinteger [0-9]+dreal ([0-9]*"."[0-9]+)ereal ([0-9]*"."[0-9]+[EedD][+-]?[0-9]+)real {dreal}|{ereal}nl /nplus