OpenCores
URL https://opencores.org/ocsvn/sc2v/sc2v/trunk

Subversion Repositories sc2v

[/] [sc2v/] [trunk/] [src/] [sc2v_step1.l] - Blame information for rev 6

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 jcastillo
/* -----------------------------------------------------------------------------
2
 *
3 4 jcastillo
 *  SystemC to Verilog Translator v0.2
4 2 jcastillo
 *  Provided by OpenSoc Design
5
 *
6
 *  www.opensocdesign.com
7
 *
8
 * -----------------------------------------------------------------------------
9
 *  This program is free software; you can redistribute it and/or modify
10
 *  it under the terms of the GNU General Public License as published by
11
 *  the Free Software Foundation; either version 2 of the License, or
12
 *  (at your option) any later version.
13
 *
14
 *  This program is distributed in the hope that it will be useful,
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 *  GNU Library General Public License for more details.
18
 *
19
 *  You should have received a copy of the GNU General Public License
20
 *  along with this program; if not, write to the Free Software
21
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
 */
23
 
24
 
25
%{
26
#include 
27
#include "y.tab.h"
28
 
29
extern int yylval;
30
 
31
%}
32
 
33
%%
34 4 jcastillo
"void"                              return VOID;
35 6 jcastillo
"true"                              return TTRUE;
36
"false"                             return TFALSE;
37 2 jcastillo
[0-9]+                              yylval=atoi(yytext); return NUMBER;
38 4 jcastillo
"::"                                return TWODOUBLEPOINTS;
39 2 jcastillo
sc_int                              return SC_INT;
40
sc_uint                             return SC_UINT;
41
sc_bigint                           return SC_BIGINT;
42
sc_biguint                          return SC_BIGUINT;
43
bool                                return BOOL;
44 4 jcastillo
">"                                 return BIGGER;
45
"<"                                 return LOWER;
46 2 jcastillo
"{"                                 return OPENKEY;
47
"}"                                 return CLOSEKEY;
48
"("                                 return OPENPAR;
49
")"                                 return CLOSEPAR;
50
"["                                 return OPENCORCH;
51
"]"                                 return CLOSECORCH;
52
".write"                            return WRITE;
53
"switch"                            return SWITCH;
54
"case"                              return CASE;
55
"default"                           return DEFAULT;
56
"break"                             return BREAK;
57
".read"                             return READ;
58
".range"                            return RANGE;
59
[a-zA-Z][_a-zA-Z0-9]*               yylval=(int)strdup(yytext); return WORD;
60
[.:"^"!%()=/+*_"&""?""|""\\"]       yylval=(int)strdup(yytext); return SYMBOL;
61
"-"                                 yylval=(int)strdup(yytext); return SYMBOL;
62
"~"                                 yylval=(int)strdup(yytext); return SYMBOL;
63
"@"                                 yylval=(int)strdup(yytext); return SYMBOL;
64
","                                 return COLON;
65
";"                                 return SEMICOLON;
66 4 jcastillo
[" "]+                              /*Ignore white spaces*/
67
"\t"                                return TAB; /*Ignore Tab*/
68 2 jcastillo
"\n"                                return NEWLINE;
69
"0x"                                return HEXA;
70 4 jcastillo
"$"                                 return DOLLAR; /* Ignore $ */
71
"(int)"                             return INTCONV; /* Ignore int type conversions*/
72
 
73
"#define"                           return DEFINE;
74
"#include"
75
"#ifdef"                            return PIFDEF;
76
"#else"                             return PELSE;
77
"#endif"                            return PENDDEF;
78
 
79
 
80
"//"[ ]*[tT][rR][aA][nN][sS][lL][aA][tT][eE][ ]*[oO][fF][fF]  return TRANSLATEOFF;  /*Translate directive*/
81
"//"[ ]*[tT][rR][aA][nN][sS][lL][aA][tT][eE][ ]*[oO][nN]      return TRANSLATEON;   /*Translate directive*/
82
"/*"[ ]*[vV][eE][rR][iI][lL][oO][gG][ ]*[bB][eE][gG][iI][nN]  return VERILOGBEGIN;
83
[vV][eE][rR][iI][lL][oO][gG][ ]*[eE][nN][dD]"*/"              return VERILOGEND;
84
 
85 2 jcastillo
%%

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.