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

Subversion Repositories sc2v

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

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 2 jcastillo
[0-9]+                              yylval=atoi(yytext); return NUMBER;
36 4 jcastillo
"::"                                return TWODOUBLEPOINTS;
37 2 jcastillo
sc_int                              return SC_INT;
38
sc_uint                             return SC_UINT;
39
sc_bigint                           return SC_BIGINT;
40
sc_biguint                          return SC_BIGUINT;
41
bool                                return BOOL;
42 4 jcastillo
">"                                 return BIGGER;
43
"<"                                 return LOWER;
44 2 jcastillo
"{"                                 return OPENKEY;
45
"}"                                 return CLOSEKEY;
46
"("                                 return OPENPAR;
47
")"                                 return CLOSEPAR;
48
"["                                 return OPENCORCH;
49
"]"                                 return CLOSECORCH;
50
".write"                            return WRITE;
51
"switch"                            return SWITCH;
52
"case"                              return CASE;
53
"default"                           return DEFAULT;
54
"break"                             return BREAK;
55
".read"                             return READ;
56
".range"                            return RANGE;
57
[a-zA-Z][_a-zA-Z0-9]*               yylval=(int)strdup(yytext); return WORD;
58
[.:"^"!%()=/+*_"&""?""|""\\"]       yylval=(int)strdup(yytext); return SYMBOL;
59
"-"                                 yylval=(int)strdup(yytext); return SYMBOL;
60
"~"                                 yylval=(int)strdup(yytext); return SYMBOL;
61
"@"                                 yylval=(int)strdup(yytext); return SYMBOL;
62
","                                 return COLON;
63
";"                                 return SEMICOLON;
64 4 jcastillo
[" "]+                              /*Ignore white spaces*/
65
"\t"                                return TAB; /*Ignore Tab*/
66 2 jcastillo
"\n"                                return NEWLINE;
67
"0x"                                return HEXA;
68 4 jcastillo
"$"                                 return DOLLAR; /* Ignore $ */
69
"(int)"                             return INTCONV; /* Ignore int type conversions*/
70
 
71
"#define"                           return DEFINE;
72
"#include"
73
"#ifdef"                            return PIFDEF;
74
"#else"                             return PELSE;
75
"#endif"                            return PENDDEF;
76
 
77
 
78
"//"[ ]*[tT][rR][aA][nN][sS][lL][aA][tT][eE][ ]*[oO][fF][fF]  return TRANSLATEOFF;  /*Translate directive*/
79
"//"[ ]*[tT][rR][aA][nN][sS][lL][aA][tT][eE][ ]*[oO][nN]      return TRANSLATEON;   /*Translate directive*/
80
"/*"[ ]*[vV][eE][rR][iI][lL][oO][gG][ ]*[bB][eE][gG][iI][nN]  return VERILOGBEGIN;
81
[vV][eE][rR][iI][lL][oO][gG][ ]*[eE][nN][dD]"*/"              return VERILOGEND;
82
 
83 2 jcastillo
%%

powered by: WebSVN 2.1.0

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