Subversion Repositories Vertical

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 mjames 1
%{
2
/*
3
 * $Id: frb_yacc.y,v 1.10 2002/10/02 19:37:29 MJAMES Exp $
4
 *
5
 * $Log: frb_yacc.y,v $
6
 * Revision 1.10  2002/10/02 19:37:29  MJAMES
7
 * Moved dummy functions to a separate support file.
8
 *
9
 * Used correct number of arguments to define_pin
10
 *
11
 * Revision 1.9  2002/09/09 10:36:20  mjames
12
 * Checkpoint checkin
13
 *
14
 * Revision 1.8  2002/01/21 09:34:50  mjames
15
 * FRBread adds the ability to ignore .ATT_PIN construct that appears in
16
 * a recent FRB file.
17
 *
18
 * Revision 1.7  2001/10/31 22:20:06  mjames
19
 * Tidying up problematical comments caused by CVS
20
 * 'intelligent' comment guessing
21
 *
22
 * Revision 1.6  2001/10/02 20:53:47  mjames
23
 * Moved documentation about code to main program module.
24
 *
25
 * Revision 1.5  2001/08/31 09:36:41  mjames
26
 * removed DOS line endings
27
 *
28
 * Revision 1.4  2001/06/06 12:10:22  mjames
29
 * Move from HPUX
30
 *
31
 * Revision 1.3  2001/03/29 08:27:07  mjames
32
 * Converted frbread for use with the newer files from the drawing office
33
 *
34
 * Revision 1.2  2000/12/04 13:14:02  mjames
35
 * Imported all of the PCB syntax readers.
36
 *
37
 * Converted "a/b" to mean "a" divided by "b" insted of a single string
38
 * "a/b" in Verilog
39
 *
40
 * Revision 1.1.1.1  2000/10/19 21:58:38  mjames
41
 * Mike put it here
42
 *  */
43
 
44
 
45
 
46
 
47
#include <stdio.h>
48
#include <stdlib.h>
49
#include <string.h>
50
#include "expression.h"
51
#include "generic.h"
52
#include "database.h"
53
 
54
 
55
static char IDstr[] = "@(#)$Header: /cygwin/cvsroot/vertical/frb_yacc.y,v 1.10 2002/10/02 19:37:29 MJAMES Exp $";
56
 
57
 
58
static socket_t * current_chip;
59
static char curr_net_nam[MAXIDLEN];
60
static int curr_pin_dir;
61
int inside_block;
62
 
63
%}
64
%union { char * string; }
65
%token HEADER TIME JOB TYPE APP ADD_COM ADD_TER TER END UNITS 
66
%token ATT_COM ATT_TRE ATT_PIN
67
%token NL  ENDFILE
68
%token <string> ASTRING
69
 
70
%%
71
 
72
file   : objects;
73
 
74
 
75
 
76
objects : objects object
77
        | object
78
        ;
79
 
80
 
81
object  : header_line NL
82
        | add_comp_line NL
83
        | add_ter_line NL
84
        | ter_block NL
85
        | gap
86
        | END gap
87
        ;
88
 
89
 
90
header_line :junktag { } junk ; 
91
 
92
junktag : HEADER | TIME | JOB | APP  | TYPE | UNITS | ATT_COM | ATT_TRE  | ATT_PIN ;
93
 
94
add_comp_line : ADD_COM  ASTRING ASTRING ASTRING  {
95
                 current_chip = find_socket(Ident,$2,Create,&socket_head);
96
                 set_socket(current_chip,Type,$3) ;
97
                 set_socket(current_chip,Value,$4) ;
98
                 };
99
 
100
add_ter_line : ADD_TER ASTRING ASTRING ASTRING {
101
                   define_pin(&routed_list,
102
                              find_socket(Ident,$2,Create,&socket_head),
103
                              $4,BIDIR,0,$3,default_vhdl_datatype,NULL);
104
                   strcpy(curr_net_nam,$4);
105
                   };
106
 
107
ter_block   : TER ter_lines NL;
108
 
109
ter_lines   : ter_lines NL ter_line 
110
            | ter_line 
111
            ;
112
 
113
ter_line:    ASTRING ASTRING {
114
             define_pin(&routed_list,
115
                        find_socket(Ident,$1,Create,&socket_head),
116
                        curr_net_nam,BIDIR,0,$2,default_vhdl_datatype,NULL);
117
             }
118
            ;
119
 
120
 
121
junk      : any junk 
122
          | any
123
          | /* nothing */
124
          ;
125
 
126
 
127
any : ASTRING {  }
128
    ;
129
 
130
 
131
 
132
gap              : NL gap
133
                 | NL
134
                 ;
135
 
136
 
137
 
138
%%
139
 
140
/* defining lineno here */
141
 
142
int lineno;
143
extern char * yytext;
144
 
145
int yyerror(char * x)
146
  {
147
  int token;
148
  printf("-- Error --> %s near string (%s) at line %d\n",x,yytext,lineno);
149
/*  for(token = yylex();token >= 0 && token!=NL;token = yylex());  */
150
  return 1;
151
  }
152
 
153
int yywrap(void)
154
  {
155
  printf("-- end of file at line %d\n",lineno);
156
  return 1;
157
  }
158
 
159
 
160