mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-08-30 00:03:42 +02:00
50 lines
835 B
OCaml
50 lines
835 B
OCaml
/* Parses basis sets GAMESS format */
|
|
|
|
%{
|
|
|
|
%}
|
|
|
|
%token <string> ELEMENT
|
|
%token <char> ANG_MOM
|
|
%token <int> INTEGER
|
|
%token <float> FLOAT
|
|
%token SPACE
|
|
%token EOL
|
|
%token EOF
|
|
|
|
%start input
|
|
%type <GeneralBasis.t> input
|
|
|
|
%% /* Grammar rules and actions follow */
|
|
|
|
input:
|
|
| basis { $1 }
|
|
| EOL input { $2 }
|
|
|
|
basis:
|
|
| element shell_array EOL { ($1, $2) }
|
|
| element shell_array EOF { ($1, $2) }
|
|
|
|
element:
|
|
| ELEMENT { Element.of_string $1 }
|
|
|
|
shell_array:
|
|
| shell_list { Array.of_list @@ List.rev $1 }
|
|
|
|
shell_list:
|
|
| { [] }
|
|
| shell_list shell { $2 :: $1 }
|
|
|
|
shell:
|
|
| ANG_MOM INTEGER EOL primitive_list { (AngularMomentum.of_char $1, Array.of_list @@ List.rev $4 ) }
|
|
|
|
primitive_list:
|
|
| { [] }
|
|
| primitive_list primitive { $2 :: $1 }
|
|
|
|
primitive:
|
|
| INTEGER FLOAT FLOAT EOL { GeneralBasis.{exponent=$2 ; coefficient=$3 } }
|
|
|
|
|
|
|