Pianoscore:.Limit(Bibinf,Signatures,Lines,Generalnotes,Articulations,
Dynamicres,Absloudsigns,Tempi);

//The basic Forms of Bibinf are:
              
&begin(Form)
Composer:.Simple(Z<ASCII>);
Title:.Simple(Z<ASCII>);
Date:.Simple(Z<ASCII>);
Instru:.Simple(Z<ASCII>);  
/*this specifies the keyboard instrument such as
piano, harpsichord,etc.*/
Edition:.Simple(Z<ASCII>);
             
//Together they define the bibliographic information:
             
Bibinf:.Limit(Composer,Title,Date,Instru,Edition);
      
          
//The basic Forms for Signatures are:
             
Onset:.Simple(R);
Keysig:.Simple(Z);
Timesig:.Simple(Z^2);  //Z^2 is the second power of Z

//Then we define Keysigss

Keysigss:2O.Power(Keysig)
              
//Then we define the products:
             
Keysigevent:.Limit(Onset,Keysigss);
Timesigevent:.Limit(Onset,Timesig);
              
/*Then we define sets of Keysigevent and Timesigevent. From here on in,
the identifier 2O is the canonical functor embedding of 2^Formname>->
Omega^Formname.*/
           
Keysigs:2O.Power(Keysigevent);
Timesigs:2O.Power(Timesigevent);
             
//This gives us Signatures:
              
Signatures:.Limit(Keysigs,Timesigs);
              
//The basic Forms for Tempi are:
              
Tempostring:.Simple(Z<ASCII>);
Quartermetronome:.Simple(R);  
/* Maelzel Metronome number in quarters per
minute.*/
   
Duration:.Simple(R);   
//Then we have the compound Forms:
             
Combtempo:.Limit(Tempostring,Quartermetronome);
Tempo:.Colimit(Tempostring,Combtempo);
Tempoevent:.Limit(Onset,Tempo,Duration);
           
//This gives us Tempi:
              
Tempi:2O.Power(Tempoevent);
              
//Then we have the following Forms that we need for Lines
     
Barline:.Syn(Onset);
Barlines:2O.Power(Barline);
             
Rep:.Limit(Barline,Duration);
             
/*A Repetition denotator means:jump from the onset of Barline to the
onset of Barline + Duration in the score time. Repetition means negative
Duration.*/ 

//We also have Reps

Reps:2O.Power(Rep);
              
//Another basic Form for Reps:
             
Length:.Simple(Z);
             
//With the compound Forms:
            
Item:.Limit(Reps,List(Reps));
             
List(Reps):.Colimit(Item(Reps),Length);
             
Reps:.Syn(List(Reps));
     
//Then we have the Form "Lines":
     
Lines:.Limit(Barlines,Reps);
             
//Next we introduce the Form for Generalnotes:
            
Pitch:.Simple(Z); //This is the number of the key, with middle C =40
            
Loudness:.Simple(Z<ASCII>);
             
Alt:.Simple(Z<SHP,FLT,NAT>);
/*Combinations of three words, SHP for sharp, FLT for flat and NAT for
natural, with the empty word for a note withour alteration sign*/
             
Artsymb:.Simple(Z<ASCII>);
//Articulation symbols such as martellato, staccato points, etc.
             
Artsymbs:2O.Power(Artsymb);
             
Note:.Limit(Onset,Pitch,Duration,Loudness,Alt,Artsymbs);
Notes:2O.Power(Note);
   
Rest:.Limit(Onset,Duration);
Rests:2O.Power(Rest);
             
Trillsymb:.Simple(Z<ASCII>);
             
Trillnote:.Limit(Note,Trillsymb);
Trillnotes:2O.Power(Trillnote);
/*Trillnotes are a special type of ornamental structures and need this
special form.*/
      
//So the general note event is:
             
Generalnote:.Colimit(Note,Rest,Trillnote);

Generalnotes:.2O:Power(Generalnote);
            
             
//Next we look at the articulation signs of slurs and pedals:
            
Pedind:.Simple(Z);
//This will be 1,2,3 for the three pedals from right to left.
             
Pedal:.Limit(Onset,Duration,Pedind);
Pedals:2O.Power(Pedal);
             
Slur:.Syn(Generalnotes);
Slurs.2O.Power(Slur);
        
Articulation:.Colimit(Pedal,Slur);
Articulations:.2O.Power(Articulation); 
//This is a set of slurs or pedal indications
             
/*Now we indicate the relative dynamics signs (crescendo,etc.) and the
notes that are affected.*/
            
Dyname:.Simple(Z<ASCII>);           
Dynamicre:.Limit(Generalnotes,Dyname);
             
Dynamicres:20.Power(Dynamicre);
             
/*Ahora indicaremos exactly where the absolute dynamic symbols are placed
(pp,mf,etc.)*/
             
Absloudsign:.Limit(Onset,Dyname);
         
Absloudsigns:20.Power(Absloudsign);
             
Arpeggio:.Syn(Generalnotes);
            
Arpeggi:.2O.Power(Arpeggio);

&end(FORM)