summaryrefslogtreecommitdiff
path: root/src/intersim/config.y
blob: d2388c90df1b823707cb81ced7a301ad8298e23f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
%{

#include "booksim.hpp"
#include <string>
#include "config_utils.hpp"

int  configlex(void);
void configerror(string msg);

%}

%union {
  char         *name;
  unsigned int num;
  double       fnum;
}

%token <name> STR
%token <num>  NUM
%token <fnum> FNUM

%%

commands : commands command
         | command
;

command : STR '=' STR ';'   { Configuration::GetTheConfig()->Assign( $1, $3 ); free( $1 ); free( $3 ); }
        | STR '=' NUM ';'   { Configuration::GetTheConfig()->Assign( $1, $3 ); free( $1 ); }
        | STR '=' FNUM ';'  { Configuration::GetTheConfig()->Assign( $1, $3 ); free( $1 ); }
;

%%