%{ 
	open Types 
%}

%token <string> CONST
%token LPAR RPAR EOF POINT COMMA
%right COMMA
%left POINT
%start main
%type <Types.nest> main
%%
main:  nest EOF                       { $1 };

scalar: CONST                         { Scalar(float_of_string $1) }
    | CONST POINT                     { Scalar(float_of_string $1) }
    | CONST POINT CONST               { Scalar(float_of_string ($1 ^ "." ^ $3)) };

vector: LPAR nestpar RPAR             { Vector($2) };

nestpar: nest                         { Unary($1) }
    | nest COMMA nestpar              { Binary($1,$3) };

nest: scalar                          { $1 }
    | vector                          { $1 };