spot/buddy/examples/calculator/lexer.lxx
Alexandre Duret-Lutz 605dce2aac * configure.ac, Makefile.am, src/Makefile.am, doc/Makefile.am,
examples/Makefile.am, examples/Makefile.def,
examples/adder/Makefile.am, examples/calculator/Makefile.am,
examples/cmilner/Makefile.am, examples/fdd/Makefile.am,
examples/internal/Makefile.am, examples/milner/Makefile.am,
examples/money/Makefile.am, examples/queen/Makefile.am,
examples/solitar/Makefile.am, m4/debug.m4, m4/gccwarns.m4,
ChangeLog, INSTALL: New files.
* config, makefile, src/makefile, doc/makefile,
examples/adder/makefile, examples/calculator/makefile
examples/cmilner/makefile, examples/fdd/makefile,
examples/internal/makefile, examples/milner/makefile,
examples/money/makefile, examples/queen/makefile,
examples/solitare/makefile : Delete.
* examples/adder/adder.cxx, examples/fdd/statespace.cxx,
examples/internal/bddtest.cxx, examples/milner/milner.cxx,
examples/money/money.cxx, examples/queen/queen.cxx,
examples/solitare/solitare.cxx: Include iostream.
* examples/calculator/parser.y: Rename as ...
* examples/calculator/parser.yxx: ... this.  Remove spurious
comas in %token, %right, and %left arguments.
* examples/calculator/parser.h: Rename as ...
* examples/calculator/parser_.h: ... this, because the bison
rule with output parser.h (not tokens.h) from parser.y.
* examples/calculator/lexer.l: Rename as ...
* examples/calculator/lexer.lxx: ... this.  Include parser.h
instead of tokens.h.
* examples/calculator/slist.h
(voidSList::voisSListElem, SList::ite): Fix friend usage.
* src/kernel.h (DEFAULT_CLOCK): Default to 60 if not already
defined.
* README: Update build instruction, and file listing.
2003-05-05 13:44:49 +00:00

101 lines
2.4 KiB
Text

/*************************************************************************
FILE: lexer.l
DESCR: FLEX rules for BDD calculator
AUTH: Jorn Lind
DATE: (C) may 1999
*************************************************************************/
%{
#include <string.h>
#include <stdlib.h>
#include "parser_.h"
#include "parser.h"
%}
/*************************************************************************
Macros and sub-lexers
*************************************************************************/
DIGIT [0-9]
ID [a-zA-Z_][a-zA-Z0-9_]*
LINE [^\n]
%x COMM
%%
/**************************************************************************
Tokens
**************************************************************************/
/* Keywords */
"initial" return T_initial;
"inputs" return T_inputs;
"actions" return T_actions;
"exist" return T_exist;
"forall" return T_forall;
"size" return T_size;
"dot" return T_dot;
"autoreorder" return T_autoreorder;
"reorder" return T_reorder;
"win2" return T_win2;
"win2ite" return T_win2ite;
"sift" return T_sift;
"siftite" return T_siftite;
"none" return T_none;
"cache" return T_cache;
"tautology" return T_tautology;
"true" return T_true;
"false" return T_false;
"print" return T_print;
/* Symbols and operators */
"." return T_dot;
"(" return T_lpar;
")" return T_rpar;
";" return T_semi;
"=" return T_equal;
"<>" return T_biimp;
"=>" return T_imp;
"|" return T_or;
"^" return T_xor;
"&" return T_and;
"~" return T_not;
"biimp" return T_biimp;
"imp" return T_imp;
"or" return T_or;
"xor" return T_xor;
"and" return T_and;
"not" return T_not;
"nand" return T_nand;
"nor" return T_nor;
/* Identifiers and constant values */
{ID} { strncpy(yylval.id, yytext, MAXIDLEN); return T_id; }
{DIGIT}+ { yylval.ival = atol(yytext); return T_intval; }
/* Strings */
\"[^\"]*\" { yylval.str=sdup(yytext+1);
yylval.str[strlen(yylval.str)-1]=0; return T_str; }
/* Whitespace */
[\n] { linenum++; }
[\r\t\f ] /* ignore blanks */
"//"{LINE}* /* Remove one line comments */
/**************************************************************************
Remove multi line comments
**************************************************************************/
"/*" BEGIN COMM;
<COMM>[^*\n]* /* ignore */
<COMM>"*"[^*/\n]* /* ignore */
<COMM>\n { linenum++; }
<COMM>"*/" BEGIN INITIAL;
. { yyerror("Unknown symbol"); }