[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Multiple Lexer
From: |
Philip Herron |
Subject: |
Multiple Lexer |
Date: |
Wed, 15 Apr 2009 13:41:15 +0100 |
User-agent: |
Thunderbird 2.0.0.21 (X11/20090318) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hey
I have been going through the autoconf/automake mailing lists for this.
I thought i had this fixed.
So my problems is i have a program which it would be nice to have 2
completely separate lexers only one of them needs a yacc grammar file.
So i dont know if its possible but it would be really awesome if i can
do it. I keep getting the errors:
So what i have done so far is in my first lexer its a really basic lexer
but it was better use flex than write it manualy:
//gdb hack for multiple lexers
#define yymaxdepth al_maxdepth
#define yyparse al_parse
#define yylex al_lex
#define yyerror al_error
#define yylval al_lval
#define yychar al_char
#define yydebug al_debug
#define yypact al_pact
#define yyr1 al_r1
#define yyr2 al_r2
#define yydef al_def
#define yychk al_chk
#define yypgo al_pgo
#define yyact al_act
#define yyexca al_exca
#define yyerrflag al_errflag
#define yynerrs al_nerrs
#define yyps al_ps
#define yypv al_pv
#define yys al_s
#define yy_yys al_yys
#define yystate al_state
#define yytmp al_tmp
#define yyv al_v
#define yy_yyv al_yyv
#define yyval al_val
#define yylloc al_lloc
#define yyreds al_reds
#define yytoks al_toks
#define yylhs al_yylhs
#define yylen al_yylen
#define yydefred al_yydefred
#define yydgoto al_yydgoto
#define yysindex al_yysindex
#define yyrindex al_yyrindex
#define yygindex al_yygindex
#define yytable al_yytable
#define yycheck al_yycheck
#define yyname al_yyname
#define yyrule al_yyrule
I put that in the lexer to make sure the symbols are re-defined. I think
this seems to work ok.
But my 2nd lexer which has a yacc grammar file also i do the same thing
but i started to added in those same defines with different prefixes and
it gives me the errors:
ActivationEngine-activationLexer.o:/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/activationLexer.c:1720:
first defined here
ActivationEngine-rulesLexer.o: In function `yyfree':
/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/rulesLexer.c:1924:
multiple definition of `yyfree'
ActivationEngine-activationLexer.o:/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/activationLexer.c:1816:
first defined here
ActivationEngine-rulesLexer.o: In function `yy_delete_buffer':
/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/rulesLexer.c:1468:
multiple definition of `yy_delete_buffer'
ActivationEngine-activationLexer.o:/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/activationLexer.c:1360:
first defined here
ActivationEngine-rulesLexer.o: In function `yypop_buffer_state':
/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/rulesLexer.c:1578:
multiple definition of `yypop_buffer_state'
ActivationEngine-activationLexer.o:/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/activationLexer.c:1470:
first defined here
ActivationEngine-rulesLexer.o: In function `yylex_destroy':
/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/rulesLexer.c:1862:
multiple definition of `yylex_destroy'
ActivationEngine-activationLexer.o:/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/activationLexer.c:1754:
first defined here
ActivationEngine-rulesLexer.o: In function `yyrealloc':
/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/rulesLexer.c:1912:
multiple definition of `yyrealloc'
ActivationEngine-activationLexer.o:/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/activationLexer.c:1804:
first defined here
ActivationEngine-rulesLexer.o: In function `yyalloc':
/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/rulesLexer.c:1907:
multiple definition of `yyalloc'
ActivationEngine-activationLexer.o:/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/activationLexer.c:1799:
first defined here
ActivationEngine-rulesLexer.o: In function `yypush_buffer_state':
/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/rulesLexer.c:1548:
multiple definition of `yypush_buffer_state'
ActivationEngine-activationLexer.o:/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/activationLexer.c:1440:
first defined here
ActivationEngine-rulesLexer.o: In function `yy_switch_to_buffer':
/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/rulesLexer.c:1395:
multiple definition of `yy_switch_to_buffer'
ActivationEngine-activationLexer.o:/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/activationLexer.c:1287:
first defined here
ActivationEngine-rulesLexer.o: In function `yy_scan_buffer':
/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/rulesLexer.c:1646:
multiple definition of `yy_scan_buffer'
ActivationEngine-activationLexer.o:/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/activationLexer.c:1538:
first defined here
ActivationEngine-rulesLexer.o: In function `yy_scan_bytes':
/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/rulesLexer.c:1696:
multiple definition of `yy_scan_bytes'
ActivationEngine-activationLexer.o:/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/activationLexer.c:1588:
first defined here
ActivationEngine-rulesLexer.o: In function `yy_scan_string':
/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/rulesLexer.c:1683:
multiple definition of `yy_scan_string'
ActivationEngine-activationLexer.o:/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/activationLexer.c:1575:
first defined here
ActivationEngine-rulesLexer.o: In function `yy_create_buffer':
/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/rulesLexer.c:1440:
multiple definition of `yy_create_buffer'
ActivationEngine-activationLexer.o:/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/activationLexer.c:1332:
first defined here
ActivationEngine-rulesLexer.o: In function `yyrestart':
/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/rulesLexer.c:1378:
multiple definition of `yyrestart'
ActivationEngine-activationLexer.o:/home/redbrain/workspace/reservoir/a5/wp53/src/trunk/OVF_Activation_Framework/OVF_ActivationEngine/src/activationLexer.c:1
there are more errors but its the same things.. just couldnt copy and
paste it all from cat :P
It would be nice to know whats the best strategy for multiple lexers.
But if it is simple to just have one lexer and multiple grammar files i
could try and work with that again... I tried that before but its not
the nicest solution. For my stuff
But i can write the first lexer manualy again because its only a very
simple parser. But i am no bison/flex guru so i'll ask the experts :)
- -Phil
http://redbrain.o.uk
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAknl1eQACgkQAhcOgIaQQ2EeUQCfVmPEsVKi6O2QMosDKbxHmRSU
2JMAoJKKzwbLak0UYIN3OBAVGO3OdVLL
=Jffd
-----END PGP SIGNATURE-----
- Multiple Lexer,
Philip Herron <=