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

Subversion Repositories sc2v

[/] [sc2v/] [trunk/] [src/] [sc2v_step2.l] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 jcastillo
/* -----------------------------------------------------------------------------
2
 *
3
 *  SystemC to Verilog Translator v0.1
4
 *  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
#include 
26
#include "y.tab.h"
27
 
28
extern int yylval;
29
 
30
int includefound = 0;
31
int linecomment = 0;
32
int multilinecomment = 0;
33
%}
34
 
35
%%
36
"\t"                    /* ignore whitespace */
37
" "                     /* ignore whitespace */
38
[0-9]+                  if(!includefound & !linecomment & !multilinecomment) {
39
                           yylval=atoi(yytext);
40
                           return NUMBER;
41
                         }
42
SC_MODULE               if(!includefound & !linecomment & !multilinecomment) return SC_MODULE;
43
SC_METHOD               if(!includefound & !linecomment & !multilinecomment) return SC_METHOD;
44
SC_CTOR                 if(!includefound & !linecomment & !multilinecomment) return SC_CTOR;
45
"void"                  if(!includefound & !linecomment & !multilinecomment) return VOID;
46
sensitive_pos           if(!includefound & !linecomment & !multilinecomment) return SENSITIVE_POS;
47
sensitive_neg           if(!includefound & !linecomment & !multilinecomment) return SENSITIVE_NEG;
48
sensitive               if(!includefound & !linecomment & !multilinecomment) return SENSITIVE;
49
"<<"                    if(!includefound & !linecomment & !multilinecomment) return SENSIBLE;
50
sc_in                   if(!includefound & !linecomment & !multilinecomment) return SC_IN;
51
sc_out                  if(!includefound & !linecomment & !multilinecomment) return SC_OUT;
52
sc_signal               if(!includefound & !linecomment & !multilinecomment) return SC_SIGNAL;
53
"bool"                  if(!includefound & !linecomment & !multilinecomment) return BOOL;
54
"<"                     if(!includefound & !linecomment & !multilinecomment) return MENOR;
55
">"                     if(!includefound & !linecomment & !multilinecomment) return MAYOR;
56
sc_int                  if(!includefound & !linecomment & !multilinecomment) return SC_INT;
57
sc_uint                 if(!includefound & !linecomment & !multilinecomment) return SC_UINT;
58
sc_bigint               if(!includefound & !linecomment & !multilinecomment) return SC_INT;
59
sc_biguint              if(!includefound & !linecomment & !multilinecomment) return SC_UINT;
60
\(                      if(!includefound & !linecomment & !multilinecomment) return OPENPAR;
61
\)                      if(!includefound & !linecomment & !multilinecomment) return CLOSEPAR;
62
;                       if(!includefound & !linecomment & !multilinecomment) return SEMICOLON;
63
","                     if(!includefound & !linecomment & !multilinecomment) return COLON;
64
"{"                     if(!includefound & !linecomment & !multilinecomment) return OPENKEY;
65
"}"                     if(!includefound & !linecomment & !multilinecomment) return CLOSEKEY;
66
"->"                    if(!includefound & !linecomment & !multilinecomment) return ARROW;
67
"="                     if(!includefound & !linecomment & !multilinecomment) return EQUALS;
68
"new"                   if(!includefound & !linecomment & !multilinecomment) return NEW;
69
"\""                    if(!includefound & !linecomment & !multilinecomment) return QUOTE;
70
[a-zA-Z][a-z_A-Z0-9]*   if(!includefound & !linecomment & !multilinecomment) {
71
                           yylval=(int)strdup(yytext);
72
                           return WORD;
73
                        }
74
"*"                     if(!includefound & !linecomment & !multilinecomment) return ASTERISCO;
75
"\n"                    includefound = 0; linecomment = 0;
76
"$"                     /* ignore */
77
"."                     /* ignore */
78
":"                     /* ignore */
79
"#include"              includefound = 1;
80
"//"                    linecomment = 1;
81
"/*"                    multilinecomment = 1;
82
"*/"                    multilinecomment = 0;
83
"/"                     /* ignore */
84
"-"
85
"#"
86
"@"
87
"|"
88
"~"
89
 
90
%%

powered by: WebSVN 2.1.0

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