Ãðàììàòèêà ÿçûêà COLAMO â ðàñøèðåííîé ôîðìå Áýêóñà-Íàóðà
öèôðà = '0' |Ò | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'. ñèìâîë = 'A'...'Z' | 'à' ...'z' | '_'. ÷èñëî = öèôðà{öèôðà}. êîíñòàíòà = ÷èñëî. çíàêîïåðàöèè = '+' | '-'|'*'| '/'| '&'| '^'| '|' |'>>'| '<<’. ñèìâîëè÷åñêîåèìÿ = ñèìâîë {ñèìâîë} |ñèìâîë {÷èñëî}. ïðîãðàììà = 'PROGRAM' [èìÿïðîãðàììû] [òåëîïðîãðàììû] 'ENDPROGRAM'. èìÿïðîãðàììû = ñèìâîëè÷åñêîåèìÿ. òåëîïðîãðàììû = [îïèñàíèåïåðåìåííûõ] [îïñàíèå_ ìåòîê] [îïèñàíèåêîíñòàíò] [èíèöàëèçàöÿïåðåìåííûõ] [Îïåðàòîðûçàãðóçêèïàìÿòèäàííûõ] [îïèñàíèå_ïîäêàäðîâ][îïèñàíèå_êàäðîâ] [îïèñàíèåâûçûâàåìûõïðîãðàìì] [âûçîâûêàäðîâ]. îïèñàíèåïåðåìåííûõ = ‘VAR’ îïèñàíèåïåðåìåííîé {îïèñàíèåïåðåìåííîé} | ‘VAR’ îïèñàíèåìàññèâà { îïèñàíèåìàññèâà }. îïèñàíèåïåðåìåííîé = ñïèñîêïåðåìåííûõ ‘:’ òèïïåðåìåííîé òèïõðàíåíèÿ ‘;’ ñïèñîêïåðåìåííûõ = èìÿïåðåìåííîé {‘,’ èìÿïåðåìåííîé}. ìÿïåðåìåííîé = ñèìâîëè÷åñêîåèìÿ. òèï ïåðåìåííîé = REAL’|’BOOLEAN’|’INTEGER’ |’ARRAY’ òèïõðàíåíèÿ = ‘MEM ’|’COM’|’REG’. îïèñàíèåìàññèâà = èìÿïåðåìåííîé : ‘ARRAY‘ ‘[‘ ðàçìåðíîñòüìàññèâà‘]’òèïõðàíåíèÿ ‘;’. ðàçìåðíîñòüìàññèâà = ðàçìåðíîñòüèçìåðåíèÿ {‘,’ ðàçìåðíîñòüèçìåðåíèÿ }. ðàçìåðíîñòüèçìåðåíèÿ = ÷èñëî : ‘VECTOR’ | ‘STREAM’. îïèñàíèåìåòîê = ‘LABEL’ èìÿìåòêè {‘,’ èìÿìåòêè }‘;’. \ èìÿìåòêè = ñèìâîëè÷åñêîåèìÿ. îïèñàíèåêîíñòàíò = ‘CONST’ èìÿêîíñòàíòû ‘=’ çíà÷åíèåêîíñòàíòû. èìÿêîíñòàíòû = ñèìâîëè÷åñêîåèìÿ. çíà÷åíèåêîíñòàíòû = ÷èñëî. èíèöèàëèçàöèÿïåðåìåííûõ = ‘DEFINE’ èìÿïåðåìåííîé ‘=’ âûðàæåíèåïðèñâàâàíèÿ ’;’. àðèôìåòè÷åñêîåâûðàæåíèå = [‘(’] èìÿïåðåìåííîé | èìÿïåðåìåííîé çíàêîïåðàöèè èìÿïåðåìåííîé { çíàêîïåðàöèè èìÿïåðåìåííîé } [‘)’]. îïèñàíèåêàäðîâ = ‘CADR’ [èìÿêàäðà] ñïèñîêîïåðàòîðîâ 'ENDCADR' ;. èìÿêàäðà = ñèìâîëè÷åñêîåèìÿ. ñïèñîêîïåðàòîðîâ = êîìàíäàêàäðà ‘;’{ êîìàíäàêàäðà ‘;’}. êîìàíäàêàäðà = {ìåòêà :} ïðèñâàèâàíèå | îïåðàòîðöèêëà | îïåðàòîð_óñëîâíîãî_ïåðåõîäà | îïåðàòîðáåçóñëîâíîãîïåðåõîäà. ïðèñâàèâàíèå = èìÿïåðåìåííîé ‘:=’ àðèôìåòè÷åñêîåâûðàæåíèå ‘;’. îïåðàòîðöèêëà = ‘FOR’ ñ÷åò÷èê ‘:=’ íà÷àëüíîåçíà÷åíèå ‘ÒÎ' êîíå÷íîåçíà÷åíèå [‘STEP’ çíà÷åíèåøàãà] ‘DO’ [BEGIN] ñïèñîêîïåðàòîðîâ [END;]. ñ÷åò÷èê = èìÿïåðåìåííîé. íà÷àëüíîåçíà÷åíèå = Àðèôìåòè÷åñêîåâûðàæåíèå. êîíå÷íîåçíà÷åíèå = Àðèôìåòè÷åñêîåâûðàæåíèå. çíà÷åíèåøàãà = Àðèôìåòè÷åñêîåâûðàæåíèå. îïåðàòîð_óñëîâíîãî ïåðåõîäà = ‘IF’ óñëîâèå ‘THEN’ [BEGIN] ñïèñîêîïåðàòîðîâ [END] [‘ELSE’ [BEGIN] ñïèñîêîïåðàòîðîâ [END] ] ‘;’. óñëîâèå = [‘(’] âûðàæåíèå [‘)’] { çíàêîïåðàöèè [‘(’] âûðàæåíèå [‘)’] }. îïåðàòîð_áåçóñëîâíîãî_ïåðåõîäà= ‘GOTO’ èìÿìåòêè ‘;’. îïèñàíèåïîäêàäðîâ = ‘SUBCADR’ èìÿïîäêàäðà [‘(’ ñïèñîêïàðàìåòðîâ ‘)’] ñïèñîêîïåðàòîðîâ ‘ENDSUBCADR;’. èìÿïîäêàäðà = ñèìâîëè÷åñêîåèìÿ. ñïèñîêïàðàìåòðîâ = îïèñàíèåïàðàìåòðà {‘;’ îïèñàíèåïàðàìåòðà }. îïèñàíèåïàðàìåòðà = ñïèñîêïåðåìåííûõ ‘:’ òèïïåðåìåííîé òèïõðàíåíèÿ. îïèñàíèåâûçûâàåìûõïðîãðàìì = ‘SUBROUTINE’ èìÿâûçûâàåìîéïðîãðàììû [‘(’ ñïèñîêïàðàìåòðîâïîäïðîãðàììû ‘)’] [ îïèñàíèåïàðàìåòðîâôóíêöèé] [îïèñàíèåïåðåìåííûõïîäïðîãðàììû] ñïèñîêîïåðàòîðîâ 'ENDSUBROUTINE;' . èìÿâûçûâàåìîéïðîãðàììû = ñèìâîëè÷åñêîåèìÿ. îïèñàíèåïàðàìåòðîâïîäïðîãðàììû = îïèñàíèåïàðàìåòðàïîäïðîãðàììû {‘,’îïèñàíèåïàðàìåòðàïîäïðîãðàììû}. îïèñàíèåïàðàìåòðàïîäïðîãðàììû = îïèñàíèåïåðåìåííîé | îïèñàíèåìàññèâà | îïèñàíåïîäêàäðà. îïèñàíèåïîäêàäðà = èìÿïîäêàäðà. îïèñàíèåïàðàìåòðîâôóíêöèé='VAR' èìÿïðîöåäóðû ‘CONTR;’. èìÿïðîöåäóðû = ñèìâîëè÷åñêîåèìÿ. îïèñàíèåïåðåìåííûõïîäïðîãðàììû = îïèñàíèåïåðåìåííûõ [EXTERN;]