
//need to define scoping to finish this stuff
//block of code: decls
//I don't remember how we defined pitch so someone else do it
//need: list concatination and list element fetching


 
program= decls EOF  

decls= expr ; decls | e  //block of expressions


expr -> declaration | function_name | function_call | type | stmt | loop


//if then else? how to integrate
stmt -> dstmt | cstmt
    
    dstmt-> IF  quer THEN { stmt }| IF quer THEN { cstmt } ELSE { dstmt }
    cstmt-> IF quer THEN { cstmt } ELSE { cstmt } | decls
        
        quer -> data == data | data > data | data < data | data >= data | data <= data 

declaration -> name = stmt   //any declaration can be to a block of statements because earlier cstmt -> decls
   
    data -> list | fun | prim | tuple | name
    
        name-> [$a-$Z][$a-$Z, $0-$9, _]*  //name of variable
    
        tuple -> << tuple_inside >>
            tuple_inside -> _ tuple | e

        list -> plist | rlist | reglist
            plist -> p:[ pitch ] 
                pitch -> chord pitch | e
                    chord -> note / note
                        note -> preop note postop | int | e
                            preop -> ^ preop | v preop | e
                            postop -> # postop | B postop | e
            rlist -> r:[ rhythm ]
                rhythm -> beat rhythm | e
                    beat -> beat bpo | char | float
                        bpo -> o
      
            reglist -> [ reg ]
                reg -> _ reg | e
        
   

        prim -> bool | unit | num | str | char  
            bool -> bool || bool | bool && bool | true | false
            num -> int | float
                float -> int . int | .int | int.

            str -> " [$0-$9, $a-$Z, _ ]*"
            char -> ' [$a-$Z, $0-$9] '

    

function_name -> FUN name arg = expr
function_call -> name arg
    arg -> data arg | e
    
    
type-> TYPE name { type_content }
    type_content-> name = data ; type_content | e

loop-> FOR element IN list :{ decls }
    element-> name
 

