source: ThirdParty/mpqc_open/src/bin/mpqc/parse.yy@ a844d8

Candidate_v1.6.1
Last change on this file since a844d8 was 860145, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit '0b990dfaa8c6007a996d030163a25f7f5fc8a7e7' as 'ThirdParty/mpqc_open'

  • Property mode set to 100644
File size: 6.2 KB
Line 
1%{
2#ifdef DEC
3#include <math.h>
4#else
5#include <stdlib.h>
6#endif
7#include <string.h>
8#ifdef BISON
9#define YYDEBUG 0
10#if YYDEBUG != 0
11int yydebug =1;
12#endif /* YYDEBUG != 0 */
13#endif /* BISON */
14#if defined(SABER)
15#define xmalloc malloc
16#endif
17#if defined(SGI)
18#include <alloca.h>
19#endif
20#include "mpqcin.h"
21#define yyerror sc::MPQCIn::yerror
22#define yyparse sc::MPQCIn::yparse
23#define yylex sc::MPQCIn::ylex
24#define yynerrs MPQCInyynerrs
25#define yychar MPQCInyychar
26%}
27
28%union {
29 char *str;
30 int i;
31 std::vector<int> *nniv;
32 }
33
34%token T_EBC T_GBC T_CABS T_CABSP T_ABS T_ABSP T_NOT
35%token T_MOLECULE T_MULTIPLICITY T_CHARGE T_METHOD T_BASIS T_AUXBASIS T_EQUALS
36%token T_OPTIMIZE T_GRADIENT T_BEG_OPT T_END_OPT T_CARTESIAN T_INTERNAL
37%token T_REDUNDANT T_RESTART T_CHECKPOINT T_COLON T_XC T_SYMMETRY T_MEMORY
38%token T_BOHR T_ANGSTROM T_GRID T_FREQUENCIES
39%token T_DOCC T_SOCC T_FROZEN_DOCC T_FROZEN_UOCC T_ALPHA T_BETA
40%token T_OO_INPUT_KEYWORD
41%token <str> T_STRING
42%token <i> T_BOOL
43%type <str> string
44%type <i> bool
45%type <nniv> nonnegative_int_vector nonnegative_int_sequence
46
47%start input
48%%
49
50input: assignments
51 ;
52
53assignments: assignments assignment
54 |
55 ;
56
57assignment: T_MOLECULE T_COLON { begin_molecule(); }
58 molecule { end_molecule(); }
59 | T_MULTIPLICITY T_COLON string
60 { set_multiplicity($3); }
61 | T_MEMORY T_COLON string
62 { set_memory($3); }
63 | T_CHARGE T_COLON string
64 { set_charge($3); }
65 | T_METHOD T_COLON string method_options_list
66 { set_method($3); }
67 | T_BASIS T_COLON string
68 { set_basis($3); }
69 | T_AUXBASIS T_COLON string
70 { set_auxbasis($3); }
71 | T_OPTIMIZE T_COLON bool optimize_options_list
72 { set_optimize($3); }
73 | T_GRADIENT T_COLON bool
74 { set_gradient($3); }
75 | T_FREQUENCIES T_COLON bool
76 { set_frequencies($3); }
77 | T_RESTART T_COLON bool
78 { set_restart($3); }
79 | T_CHECKPOINT T_COLON bool
80 { set_checkpoint($3); }
81 | T_SYMMETRY T_COLON string
82 { set_symmetry($3); }
83 | T_DOCC T_COLON nonnegative_int_vector
84 { set_docc($3); }
85 | T_SOCC T_COLON nonnegative_int_vector
86 { set_socc($3); }
87 | T_ALPHA T_COLON nonnegative_int_vector
88 { set_alpha($3); }
89 | T_BETA T_COLON nonnegative_int_vector
90 { set_beta($3); }
91 | T_FROZEN_DOCC T_COLON nonnegative_int_vector
92 { set_frozen_docc($3); }
93 | T_FROZEN_UOCC T_COLON nonnegative_int_vector
94 { set_frozen_uocc($3); }
95 ;
96
97nonnegative_int_vector:
98 string { $$ = make_nnivec(0,$1); }
99 | T_BEG_OPT nonnegative_int_sequence T_END_OPT
100 { $$ = $2; }
101 ;
102
103nonnegative_int_sequence:
104 nonnegative_int_sequence string { $$ = make_nnivec($1,$2); }
105 | { $$ = make_nnivec(0,0); }
106 ;
107
108optimize_options_list:
109 T_BEG_OPT optimize_options T_END_OPT
110 |
111 ;
112
113optimize_options:
114 optimize_options optimize_option
115 |
116 ;
117
118optimize_option:
119 T_CARTESIAN { set_opt_type(T_CARTESIAN); }
120 | T_INTERNAL { set_opt_type(T_INTERNAL); }
121 | T_REDUNDANT { set_redund_coor(1); }
122 ;
123
124molecule: molecule_options_list atoms
125 ;
126
127atoms: atoms atom
128 |
129 ;
130
131atom: string string string string atom_options_list
132 { add_atom($1,$2,$3,$4); }
133 ;
134
135atom_options_list:
136 T_BEG_OPT atom_options T_END_OPT
137 |
138 ;
139
140atom_options:
141 atom_options atom_option
142 |
143 ;
144
145atom_option:
146 T_CHARGE T_EQUALS string { set_atom_charge($3); }
147 ;
148
149molecule_options_list:
150 T_BEG_OPT molecule_options T_END_OPT
151 |
152 ;
153
154molecule_options:
155 molecule_options molecule_option
156 |
157 ;
158
159molecule_option:
160 T_BOHR { set_molecule_bohr(1); }
161 | T_ANGSTROM { set_molecule_bohr(0); }
162 ;
163
164method_options_list:
165 T_BEG_OPT method_options T_END_OPT
166 |
167 ;
168
169method_options:
170 method_options method_option
171 |
172 ;
173
174method_option:
175 T_XC T_EQUALS string { set_method_xc($3); }
176 | T_GRID T_EQUALS string { set_method_grid($3); }
177 | T_EBC { set_method_ebc("true"); }
178 | T_GBC { set_method_gbc("true"); }
179 | T_NOT T_EBC { set_method_ebc("false"); }
180 | T_NOT T_GBC { set_method_gbc("false"); }
181 | T_CABS { set_method_absmethod("cabs"); }
182 | T_ABS { set_method_absmethod("abs"); }
183 | T_CABSP { set_method_absmethod("cabs+"); }
184 | T_ABSP { set_method_absmethod("abs+"); }
185 ;
186
187string: T_STRING { $$ = $1; }
188 ;
189
190bool: T_BOOL { $$ = $1; }
191 ;
192
193%%
Note: See TracBrowser for help on using the repository browser.