Ãëàâíàÿ » Êàòàëîã    
ðåôåðàòû Ðàçäåëû ðåôåðàòû
ðåôåðàòû
ðåôåðàòûÃëàâíàÿ

ðåôåðàòûÁèîëîãèÿ

ðåôåðàòûÁóõãàëòåðñêèé ó÷åò è àóäèò

ðåôåðàòûÂîåííàÿ êàôåäðà

ðåôåðàòûÃåîãðàôèÿ

ðåôåðàòûÃåîëîãèÿ

ðåôåðàòûÃðàôîëîãèÿ

ðåôåðàòûÄåíüãè è êðåäèò

ðåôåðàòûÅñòåñòâîçíàíèå

ðåôåðàòûÇîîëîãèÿ

ðåôåðàòûÈíâåñòèöèè

ðåôåðàòûÈíîñòðàííûå ÿçûêè

ðåôåðàòûÈñêóññòâî

ðåôåðàòûÈñòîðèÿ

ðåôåðàòûÊàðòîãðàôèÿ

ðåôåðàòûÊîìïüþòåðíûå ñåòè

ðåôåðàòûÊîìïüþòåðû ÝÂÌ

ðåôåðàòûÊîñìåòîëîãèÿ

ðåôåðàòûÊóëüòóðîëîãèÿ

ðåôåðàòûËèòåðàòóðà

ðåôåðàòûÌàðêåòèíã

ðåôåðàòûÌàòåìàòèêà

ðåôåðàòûÌàøèíîñòðîåíèå

ðåôåðàòûÌåäèöèíà

ðåôåðàòûÌåíåäæìåíò

ðåôåðàòûÌóçûêà

ðåôåðàòûÍàóêà è òåõíèêà

ðåôåðàòûÏåäàãîãèêà

ðåôåðàòûÏðàâî

ðåôåðàòûÏðîìûøëåííîñòü ïðîèçâîäñòâî

ðåôåðàòûÐàäèîýëåêòðîíèêà

ðåôåðàòûÐåêëàìà

ðåôåðàòûÐåôåðàòû ïî ãåîëîãèè

ðåôåðàòûÌåäèöèíñêèå íàóêàì

ðåôåðàòûÓïðàâëåíèå

ðåôåðàòûÔèçèêà

ðåôåðàòûÔèëîñîôèÿ

ðåôåðàòûÔèíàíñû

ðåôåðàòûÔîòîãðàôèÿ

ðåôåðàòûÕèìèÿ

ðåôåðàòûÝêîíîìèêà

ðåôåðàòû
ðåôåðàòû Èíôîðìàöèÿ ðåôåðàòû
ðåôåðàòû
ðåôåðàòû

Ñèíòàêñè÷åñêèé ðàñïîçíàâàòåëü àðèôìåòè÷åñêîãî îïåðàòîðà óñëîâíîãî ïåðåõîäà ÿçûêà


Ìèíèñòåðñòâî íàóêè, âûñøåé øêîëû è òåõíè÷åñêîé ïîëèòèêè Ðîññèéñêîé Ôåäåðàöèè.
Íîâîñèáèðñêèé Ãîñóäàðñòâåííûé Òåõíè÷åñêèé
Óíèâåðñèòåò.
Êóðñîâàÿ ðàáîòà ïî ñèñòåìíîìó ïðîãðàììèðîâàíèþ.
Ñèíòàêñè÷åñêèé
ðàñïîçíàâàòåëü àðèôìåòè÷åñêîãî îïåðàòîðà óñëîâíîãî ïåðåõîäà ÿçûêà FORTRAN.
Ôàêóëüòåò: ÀÂÒ.
Êàôåäðà: ÀÑÓ.
Ãðóïïà: À–513.
Ñòóäåíò: Áîéêî Êîíñòàíòèí Àíàòîëüåâè÷.
Ïðåïîäàâàòåëü: Øîðíèêîâ Þðèé Âëàäèìèðîâè÷.
Àññèñòåíò:    Ïàíîâà
Âåðà Áîðèñîâíà.
Äàòà: 30 àïðåëÿ 1997 ã.
Îòìåòêà î çàùèòå:
Íîâîñèáèðñê.
ßçûê îïåðàòîðà.
ßçûê àðèôìåòè÷åñêîãî îïåðàòîðà
óñëîâíîãî ïåðåõîäà ÿçûêà FORTRAN.
IF(<ÀÂ>) LABEL1,LABEL2,LABEL3
 À - Àðèôìåòè÷åñêîå Âûðàæåíèå.
LABEL1,LABEL2,LABEL3 - ïåðâàÿ, âòîðàÿ
è òðåòüÿ ìåòêè
                                                ñîîòâåòñòâåííî.
Ãðàììàòèêà ÿçûêà.
   G[<Îïåðàòîð>]:
1.
<Îïåðàòîð> ®
IF(<ÀÂ>)<LABEL>,<LABEL>,<LABEL>
2. <LABEL>
®
<ÖÁÇ>
3. <ÀÂ>
® T
| <ÀÂ>+T
| <ÀÂ>-T
4. T ® O
| T*O | T/O | T**O
5. O ®
(<ÀÂ>) | <Èäåíòèôèêàòîð> | <×ÏÇ>
6. <Èäåíòèôèêàòîð>
®
ÁÁ
7. <ÖÁÇ>
®
Ö{Ö}[L]
8.
<×ÏÇ> ® Ö{Ö}[.Ö{Ö}]
 Óñëîâíûå îáîçíà÷åíèÿ:
                     Ò – ÒÅÐÌ. Î – ÎÏÅÐÀÍÄ. Á – ÁÓÊÂÀ. Ö – ÖÈÔÐÀ. ÖÁÇ – ÖÅËÎÅ ÁÅÇ ÇÍÀÊÀ. ** – ÂÎÇÂÅÄÅÍÈÅ Â ÑÒÅÏÅÍÜ. LABEL – ÌÅÒÊÀ. ×ÏÇ – ×ÈÑËÎ Ñ ÏËÀÂÀÞÙÅÉ ÇÀÏßÒÎÉ. L – ÊÎÍÅÖ ÑÒÐÎÊÈ (ïóñòî). À – ÀÐÈÔÌÅÒÈ×ÅÑÊÎÅ ÂÛÐÀÆÅÍÈÅ.
Êëàññèôèêàöèÿ ãðàììàòèêè.
Äàííàÿ ãðàììàòèêà G[<ÎÏÅÐÀÒÎÐ>],
ñîãëàñíî êëàññèôèêàöèè Õîìñêîãî, ÿâëÿåòñÿ êîíòåêñòíî-ñâîáîäíîé, òàê êàê ïðàâàÿ
÷àñòü êàæäîé ðåäóêöèè íà÷èíàåòñÿ ëèáî ñ òåðìèíàëüíîãî ñèìâîëà, ëèáî ñ
íåòåðìèíàëüíîãî, ïðèíàäëåæàùåãî îáúåäèí¸ííîìó ñëîâàðþ.
A ® a, AÎVn, aÎV*.
Ãðàììàòèêà G[<ÎÏÅÐÀÒÎÐ>] íå ÿâëÿåòñÿ àâòîìàòíîé, òàê
êàê íå âñå å¸ ðåäóêöèè íà÷èíàþòñÿ ñ òåðìèíàëüíîãî ñèìâîëà. Ïî ýòîé æå ïðè÷èíå
äàííàÿ ãðàììàòèêà íå ÿâëÿåòñÿ S - ãðàììàòèêîé.
Ìåòîä àíàëèçà.
Äëÿ äàííîé ãðàììàòèêè
ðåàëèçîâàí ðàçáîð ìåòîäîì ðåêóðñèâíîãî ñïóñêà, ïîñêîëüêó îíà îòíîñèòñÿ ê êëàññó
êîíòåêñòíî-ñâîáîäíûõ.
        Èäåÿ
ìåòîäà ñîñòîèò â òîì, ÷òî êàæäîìó íåòåðìèíàëüíîìó ñèìâîëó ñòàâèòñÿ â
ñîîòâåòñòâèå îïðåäåë¸ííàÿ ïðîãðàììíàÿ åäèíèöà (ôóíêöèÿ), êîòîðàÿ ðàñïîçíà¸ò
öåïî÷êó, ïîðîæäàåìóþ ýòèì íåòåðìèíàëîì.
        Ýòè
ïðîöåäóðû è ôóíêöèè âûçûâàþòñÿ â ñîîòâåòñòâèè ñ ïðàâèëàìè ãðàììàòèêè è èíîãäà
âûçûâàþò ñàìè ñåáÿ.
        Äàííûé
ìåòîä ðåàëèçîâàí íà ÿçûêå C++, ïîñêîëüêó îí îáëàäàåò
ðåêóðñèâíûìè âîçìîæíîñòÿìè.
Äèàãíîñòèêà è íåéòðàëèçàöèÿ îøèáîê.
Äëÿ äàííîé ãðàììàòèêè
ïðîèçâîäèòñÿ òîëüêî äèàãíîñòèêà è íåéòðàëèçàöèÿ îøèáîê. Èñïðàâëåíèå îøèáîê íå
ïðîèçâîäèòñÿ.
Íåéòðàëèçàöèÿ îøèáîê
îñóùåñòâëÿåòñÿ ïî ìåòîäó Àéðîíñà, òî åñòü, ñïóñêàÿñü ïî ñèíòàêñè÷åñêîìó äåðåâó
áåç âîçâðàòà ïî êîíòåêñòó, ïðè îáíàðóæåíèè òóïèêîâîé ñèòóàöèè îòáðàñûâàþòñÿ òå
ëèòåðû (ñèìâîëû), êîòîðûå ïðèâåëè â òóïèêîâóþ ñèòóàöèþ è ðàçáîð ïðîäîëæàåòñÿ.
Òåñòèðîâàíèå.
¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
IF(((6/t+g*456)/(9.347*y-555))**6) 64,44,548
¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
Òåêóùèé ñèìâîë ( - 40.
AB - Ïðîâåðêà íà Àðèôìåòè÷åñêîå Âûðàæåíèå.
Òåêóùèé ñèìâîë ( - 40.
Term - Ïðîâåðêà íà Òåðì.
Operand - Ïðîâåðêà íà Îïåðàíä.
AB - Ïðîâåðêà íà Àðèôìåòè÷åñêîå Âûðàæåíèå.
Òåêóùèé ñèìâîë ( - 40.
Term - Ïðîâåðêà íà Òåðì.
Operand - Ïðîâåðêà íà Îïåðàíä.
AB - Ïðîâåðêà íà Àðèôìåòè÷åñêîå Âûðàæåíèå.
Òåêóùèé ñèìâîë 6 - 54.
Term - Ïðîâåðêà íà Òåðì.
Operand - Ïðîâåðêà íà Îïåðàíä.
IDENT - Ïðîâåðêà íà Èäåíòèôèêàòîð ñ ñèìâîëà 6.
FLOAT - ïðîâåðêà íà ÷èñëî ñ ïëàâàþùåé çàïÿòîé ñ öèôðû 6.
Òåêóùèé ñèìâîë / - 47.
Òåêóùèé ñèìâîë t - 116.
Term - Ïðîâåðêà íà Òåðì.
Operand - Ïðîâåðêà íà Îïåðàíä.
IDENT - Ïðîâåðêà íà Èäåíòèôèêàòîð ñ ñèìâîëà t.
Òåêóùèé ñèìâîë + - 43.
AB - Ïðîâåðêà íà Àðèôìåòè÷åñêîå Âûðàæåíèå.
Òåêóùèé ñèìâîë g - 103.
Term - Ïðîâåðêà íà Òåðì.
Operand - Ïðîâåðêà íà Îïåðàíä.
IDENT - Ïðîâåðêà íà Èäåíòèôèêàòîð ñ ñèìâîëà g.
Òåêóùèé ñèìâîë * - 42.
Òåêóùèé ñèìâîë 4 - 52.
Term - Ïðîâåðêà íà Òåðì.
Operand - Ïðîâåðêà íà Îïåðàíä.
IDENT - Ïðîâåðêà íà Èäåíòèôèêàòîð ñ ñèìâîëà 4.
FLOAT - ïðîâåðêà íà ÷èñëî ñ ïëàâàþùåé çàïÿòîé ñ öèôðû 4.
Òåêóùèé ñèìâîë 5 - 53.
Òåêóùèé ñèìâîë 6 - 54.
Òåêóùèé ñèìâîë ) - 41.
Òåêóùèé ñèìâîë / - 47.
Òåêóùèé ñèìâîë ( - 40.
Term - Ïðîâåðêà íà Òåðì.
Operand - Ïðîâåðêà íà Îïåðàíä.
AB - Ïðîâåðêà íà Àðèôìåòè÷åñêîå Âûðàæåíèå.
Òåêóùèé ñèìâîë 9 - 57.
Term - Ïðîâåðêà íà Òåðì.
Operand - Ïðîâåðêà íà Îïåðàíä.
IDENT - Ïðîâåðêà íà Èäåíòèôèêàòîð ñ ñèìâîëà 9.
FLOAT - ïðîâåðêà íà ÷èñëî ñ ïëàâàþùåé çàïÿòîé ñ öèôðû 9.
Òåêóùèé ñèìâîë . - 46.
Òåêóùèé ñèìâîë 3 - 51.
Òåêóùèé ñèìâîë 4 - 52.
Òåêóùèé ñèìâîë 7 - 55.
Òåêóùèé ñèìâîë * - 42.
Òåêóùèé ñèìâîë y - 121.
Term - Ïðîâåðêà íà Òåðì.
Operand - Ïðîâåðêà íà Îïåðàíä.
IDENT - Ïðîâåðêà íà Èäåíòèôèêàòîð ñ ñèìâîëà y.
Òåêóùèé ñèìâîë - - 45.
AB - Ïðîâåðêà íà Àðèôìåòè÷åñêîå Âûðàæåíèå.
Òåêóùèé ñèìâîë 5 - 53.
Term - Ïðîâåðêà íà Òåðì.
Operand - Ïðîâåðêà íà Îïåðàíä.
IDENT - Ïðîâåðêà íà Èäåíòèôèêàòîð ñ ñèìâîëà 5.
FLOAT - ïðîâåðêà íà ÷èñëî ñ ïëàâàþùåé çàïÿòîé ñ öèôðû 5.
Òåêóùèé ñèìâîë 5 - 53.
Òåêóùèé ñèìâîë 5 - 53.
Òåêóùèé ñèìâîë ) - 41.
Òåêóùèé ñèìâîë ) - 41.
Òåêóùèé ñèìâîë * - 42.
Òåêóùèé ñèìâîë * - 42.
Òåêóùèé ñèìâîë 6 - 54.
Term - Ïðîâåðêà íà Òåðì.
Operand - Ïðîâåðêà íà Îïåðàíä.
IDENT - Ïðîâåðêà íà Èäåíòèôèêàòîð ñ ñèìâîëà 6.
FLOAT - ïðîâåðêà íà ÷èñëî ñ ïëàâàþùåé çàïÿòîé ñ öèôðû 6.
Òåêóùèé ñèìâîë ) - 41.
Òåêóùèé ñèìâîë   -
32.
Òåêóùèé ñèìâîë 6 - 54.
ABS - ïðîâåðêà íà Öåëîå Áåç Çíàêà ñ öèôðû 6.
Òåêóùèé ñèìâîë 4 - 52.
Òåêóùèé ñèìâîë , - 44.
Òåêóùèé ñèìâîë 4 - 52.
ABS - ïðîâåðêà íà Öåëîå Áåç Çíàêà ñ öèôðû 4.
Òåêóùèé ñèìâîë 4 - 52.
Òåêóùèé ñèìâîë , - 44.
Òåêóùèé ñèìâîë 5 - 53.
ABS - ïðîâåðêà íà Öåëîå Áåç Çíàêà ñ öèôðû 5.
Òåêóùèé ñèìâîë 4 - 52.
Òåêóùèé ñèìâîë 8 - 56.
Òåêóùèé ñèìâîë NULL - 0.
¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
IF(r**34/50.22) 3,56,1
¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
Òåêóùèé ñèìâîë ( - 40.
AB - Ïðîâåðêà íà Àðèôìåòè÷åñêîå Âûðàæåíèå.
Òåêóùèé ñèìâîë r - 114.
Term - Ïðîâåðêà íà Òåðì.
Operand - Ïðîâåðêà íà Îïåðàíä.
IDENT - Ïðîâåðêà íà Èäåíòèôèêàòîð ñ ñèìâîëà r.
Òåêóùèé ñèìâîë * - 42.
Òåêóùèé ñèìâîë * - 42.
Òåêóùèé ñèìâîë 3 - 51.
Term - Ïðîâåðêà íà Òåðì.
Operand - Ïðîâåðêà íà Îïåðàíä.
IDENT - Ïðîâåðêà íà Èäåíòèôèêàòîð ñ ñèìâîëà 3.
FLOAT - ïðîâåðêà íà ÷èñëî ñ ïëàâàþùåé çàïÿòîé ñ öèôðû 3.
Òåêóùèé ñèìâîë 4 - 52.
Òåêóùèé ñèìâîë / - 47.
Òåêóùèé ñèìâîë 5 - 53.
Term - Ïðîâåðêà íà Òåðì.
Operand - Ïðîâåðêà íà Îïåðàíä.
IDENT - Ïðîâåðêà íà Èäåíòèôèêàòîð ñ ñèìâîëà 5.
FLOAT - ïðîâåðêà íà ÷èñëî ñ ïëàâàþùåé çàïÿòîé ñ öèôðû 5.
Òåêóùèé ñèìâîë 0 - 48.
Òåêóùèé ñèìâîë . - 46.
Òåêóùèé ñèìâîë 2 - 50.
Òåêóùèé ñèìâîë 2 - 50.
Òåêóùèé ñèìâîë ) - 41.
Òåêóùèé ñèìâîë   -
32.
Òåêóùèé ñèìâîë 3 - 51.
ABS - ïðîâåðêà íà Öåëîå Áåç Çíàêà ñ öèôðû 3.
Òåêóùèé ñèìâîë , - 44.
Òåêóùèé ñèìâîë 5 - 53.
ABS - ïðîâåðêà íà Öåëîå Áåç Çíàêà ñ öèôðû 5.
Òåêóùèé ñèìâîë 6 - 54.
Òåêóùèé ñèìâîë , - 44.
Òåêóùèé ñèìâîë 1 - 49.
ABS - ïðîâåðêà íà Öåëîå Áåç Çíàêà ñ öèôðû 1.
Òåêóùèé ñèìâîë NULL - 0.
¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
Ëèñòèíã ïðîãðàììû.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
//          FILE
"KURSOVIC.CPP".
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
//          ÂÀÐÈÀHÒ #
2.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
//          Àðèôìåòè÷åñêèé
îïåðàòîð óñëîâíîãî ïåðåõîäà ÿçûêà FORTRAN.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Êàôåäpà       : ÀÑÓ.
// Ãpóïïà          :
À-513.
// Ñòóäåíò        :
Áîéêî Êîíñòàíòèí Àíàòîëüåâè÷.
// Ïpåïîäàâàòåëè :       êàíäèäàò
òåõíè÷åñêèõ íàóê, äîöåíò     Øîpíèêîâ Þpèé
Âëàäèìèpîâè÷,
//                                  àññèñòåíò                                            Ïàíîâà
Âåpà Áîpèñîâíà.
// Äàòà             :
30 àïðåëÿ 1997ã.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Çàãîëîâî÷íûå ôàéëû.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
# include<stdio.h>
# include<conio.h>
# include<string.h>
# include<stdlib.h>
# include "keyboard.h"
# include<dos.h>
# include <ctype.h>
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Êîíñòàíòû.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
# define                        FILE_NAME   "TEXT.TXT"
# define                        YES                 1
# define                        NO                   2
# define                        OK                   3
//# define          TEST
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Ãëîáàëüíûå ïåðåìåííûå.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
char file1[22][60];                     //
Ìàññèâ ñòðîê.
char mes[22][30][50];                //
Ìàññèâ ñîîáùåíèé îá îøèáêàõ.
char bufer[4096];                      //
Ñíèìîê ñ ýêðàíà.
int  com=0;                                // Ïîêàçàòåëü :
îòêîìïèëèðîâàí ôàéë èëè íåò.
int  pos=2;                                 // Òåêóùàÿ
ïîçèöèÿ â ñòðîêå.
char string[80];                          //
Òåêóùàÿ ñòðîêà ôàéëà.
char nx;                                    //
Òåêóùèé ñèìâîë â ñòðîêå.
int  e1=0;                                  // Ñ÷åò÷èê
ñòðàíèö ìàññèâà ñîáùåíèé îá îøèáêàõ.
int  e2=0;                                  // Ñ÷åò÷èê
ñòðîê â ñòðàíèöå.
int  l=0;                                     // Ñ÷åò÷èê
ìåòîê.
FILE* fl=fopen("MESSAGE.TXT","wt");           // Ôàéë ñ ñîîáùåíèÿìè îá îøèáêàõ.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Ïðîòîòèïû ôóíêöèé.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
void Windows(int,int,int,int,char*);           // Ïîñòðîåíèå îêîí.
void Beep(int,int);                                  //
Çâóêîâîé ñèãíàë.
void Open_File(void);                            //
Îòêðûòèå ôàéëà.
void Second_Window(void);                   //
Ïîñòðîåíèå íèæíåé ïàíåëè.
void MyPuts(char*,int);                          //
Àíàëîã puts(char*).
void Print_File(void);                             //
Ïå÷àòü ôàéëà.
void Menu(void);                                   //
Ìåíþ.
int  i_readkey(void);                               // Îïðîñ
êëàâèàòóðû.
void Help(void);                                     //
Ïîìîùü.
void Grammar(void);                              //
Ãðàììàòèêà ÿçûêà.
void Language(void);                             //
ßçûê îïåðàòîðà.
void Compile(void);                                //
Êîìïèëÿöèÿ.
void Operator(char*);                            //
Ñêàíèðîâàíèå îïåðàòîðà.
void Scan(void);                                    //
Ñêàíèðîâàíèå ñëåäóþùåãî ñèìâîëà.
void Label(void);                                   //
Ðåàëèçàöèÿ Label.
int  ABS(void);                                      //
Ðåàëèçàöèÿ ABS.
int  IDENT(void);                                  // Ðåàëèçàöèÿ
IDENT.
int  AB(void);                                        //
Ðåàëèçàöèÿ AB.
void Error(int);                                      //
Îáðàáîòêà îøèáêè.
int  Term(void);                                     //
Ðåàëèçàöèÿ Term.
int  Operand(void);                                // Ðåàëèçàöèÿ
Operand.
int  Float(void);                                      //
Ðåàëèçàöèÿ Float.
void Message(int);                                 //
Âûâîä ñîîáùåíèé îá îøèáêàõ.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Ôóíêöèÿ MAIN.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
void main()
            {
            _setcursortype(_SOLIDCURSOR);
            window(1,1,80,25);
            textattr(113);
            clrscr();
            for(int
i=0;i<24;i++)
            cputs("ŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽŽ");
            textcolor(BLACK);
            cputs("
Enter filename");
            window(20,7,60,17);
            textattr(127);
            clrscr();
            Windows(20,7,60,17,"Open
a File");
            gotoxy(4,3);
            puts("Name
");
            gotoxy(6,7);
            puts("Ïî
óìîë÷àíèþ áóäåò ââåäåí ôàéë");
            gotoxy(17,8);
            puts(FILE_NAME);
            window(23,10,57,10);
            textattr(31);
            clrscr();
            Open_File();
            Second_Window();
            Print_File();
            _setcursortype(_NOCURSOR);
            Menu();
            }
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Çâóêîâîé ñèãíàë.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
void Beep(int tone,int pause)
            {
            sound(tone);
            delay(pause);
            nosound();
            }
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Ïîñòðîåíèå ðàìîê.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
void Windows(int x,int y,int x1,int y1,char* string)
{
y1++;
            for(int
i=2;i<x1-x;i++)
                        {
                        gotoxy(i,1);
                        putch('=');
                        gotoxy(i,y1-y);
                        putch('=');
                        }
            for(i=1;i<y1-y;i++)
                        {
                        gotoxy(2,i);
                        putch('¦');
                        gotoxy(x1-x,i);
                        putch('¦');
                        }
gotoxy(2,1);
putch('ã');
gotoxy(x1-x,1);
putch('¬');
gotoxy(x1-x,y1-y);
putch('-');
gotoxy(2,y1-y);
putch('L');
gotoxy((x1-x-strlen(string)+2)/2,1);
puts(string);
}
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Ôóíêöèÿ îòêðûòèÿ ôàéëà.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
void Open_File(void)
{
char filename[38];
filename[0]=35;
char* p=cgets(filename);
strcpy(filename,p);
if(filename[0]==NULL)
            strcpy(filename,FILE_NAME);
FILE *file;
if ((file = fopen(filename,
"rt"))== NULL)
                        {
            window(1,1,80,25);
                        textattr(7);
            _setcursortype(_NORMALCURSOR);
                        clrscr();
            perror("ERROR");
                        fcloseall();
            getch();
                        exit(1);
            }
            for(int
i=0;i<22;i++)
                        {
                        char
temp[255];
                        if((fgets(temp,80,file))==NULL)
                                    break;
                        strcpy(file1[i],temp);
                        }
fclose(file);
}
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Ïîñòðîåíèå íèæíåé ïàíåëè.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
void Second_Window(void)
            {
            window(1,1,80,25);
            textattr(17);
            clrscr();
            window(1,1,80,24);
            textattr(31);
            clrscr();
            Windows(1,1,80,24,"File");
            window(1,25,80,25);
            textattr(127);
            clrscr();
            MyPuts("
~F1~ Help ~F2~ Grammar ~F3~ Language ~F4~ Compile ~ESC~ Exit",
LIGHTBLUE);
            }
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// MyPuts.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
void MyPuts(char* string,int color)
            {
            int j=0;
            for(int
i=0;string[i] != NULL;i++)
                        {
                        if(string[i]=='~'
&& j==0)
                                    {
                                    textcolor(color);
                                    i++;
                                    j++;
                                    }
                        if(string[i]=='~'
&& j!=0)
                                    {
                                    textcolor(BLACK);
                                    i++;
                                    j--;
                                    }
                        cprintf("%c",string[i]);
                        if(string[i]==NULL)
                                    break;
                        }
            }
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Ôóíêöèÿ âûâîäà ôàéëà íà ýêðàí.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
void Print_File(void)
            {
            window(3,2,77,24);
            textattr(31);
            for(int
i=0;i<22;i++)
            {
                        cputs(file1[i]);
            putch('\r');
            }
            }
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Ìåíþ.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
void Menu(void)
            {
            gettext(1,1,80,25,bufer);             // Âñÿ èíôîðìàöèÿ ñ ýêðàíà
çàíîñèòñÿ â áóôåð.
            int y=1;                                     // Ñ÷åò÷èê
ñòðîê.
            gotoxy(1,1);
            textattr(63);
            clreol();
            cputs(file1[0]);
            textattr(31);
            gotoxy(5,23);
            cprintf("
%-2d ",y);
            while(1)
                        {
                        switch
(i_readkey())
                                    {
                                    case
EASC_F1:
                                    gettext(1,1,80,25,bufer);
                                    Help();
                                    puttext(1,1,80,25,bufer);
                                    break;
                                    case
EASC_F2:
                                    gettext(1,1,80,25,bufer);
                                    Grammar();
                                    puttext(1,1,80,25,bufer);
                                    break;
                                    case
EASC_F3:
                                    gettext(1,1,80,25,bufer);
                                    Language();
                                    puttext(1,1,80,25,bufer);
                                    break;
                                    case
EASC_F4:
                                    gettext(1,1,80,25,bufer);
                                    Compile();
                                    puttext(1,1,80,25,bufer);
                                    window(48,2,78,23);
                                    textattr(95);
                                    clrscr();
                                    Windows(49,3,79,24,"Message");
                                    Message(y-1);
                                    break;
                                    case
EASC_Esc:
                                    window(1,1,80,25);
                                    textattr(7);
                                    clrscr();
                                    fcloseall();
                                    exit(1);
                                    break;
                                    case
EASC_Up:
                                    if(y>1)
                                                {
                                                if(com>0)
                                                            window(3,2,47,24);
                                                else
                                                            window(3,2,77,24);
                                                y--;
                                                gotoxy(1,y);
                                                textattr(63);
                                                clreol();
                                                cputs(file1[y-1]);
                                                gotoxy(1,y+1);
                                                textattr(31);
                                                clreol();
                                                cputs(file1[y]);
                                                gotoxy(5,23);
                                                cprintf("
%d ",y);
                                                if(com>0)
                                                            Message(y-1);
                                                }
                                    break;
                                    case
EASC_Down:
                                    if(y<22)
                                                {
                                                if(com>0)
                                                            window(3,2,47,24);
                                                else
                                                            window(3,2,77,24);
                                                gotoxy(1,++y);
                                                textattr(63);
                                                clreol();
                                                cputs(file1[y-1]);
                                                gotoxy(1,y-1);
                                                textattr(31);
                                                clreol();
                                                cputs(file1[y-2]);
                                                gotoxy(5,23);
                                                cprintf("
%d ",y);
                                                if(com>0)
                                                            Message(y-1);
                                                }
                                    break;
                                    }
                        }
            }
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Help.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
void Help(void)
            {
            window(1,1,80,25);
            textattr(78);
            clrscr();
            Windows(1,1,80,25,"Help");
            window(4,3,77,23);
            cprintf("ÍÎÂÎÑÈÁÈÐÑÊÈÉ
ÃÎÑÓÄÀÐÑÒÂÅÍÍÛÉ ÒÅÕÍÈ×ÅÑÊÈÉ
ÓÍÈÂÅÐÑÈÒÅÒ\n\n\r");
            cprintf("                                    ÊÀÔÅÄÐÀ   ÀÑÓ\n\n\r");
            cprintf("            Êóðñîâàÿ ðàáîòà ïî ñèñòåìíîìó
ïðîãðàììèðîâàíèþ íà òåìó:\n\r");
            cprintf("
\"Àðèôìåòè÷åñêèé îïåðàòîð óñëîâíîãî ïåðåõîäà ÿçûêà
FORTRAN\".\n\n\r");
            cprintf("                                               
Ñòóäåíòà ãðóïïû À-513\n\n\r");
            cprintf("                                               
Áîéêî Êîíñòàíòèíà Àíàòîëüåâè÷à.\n\n\r");
            cprintf("Â
ïðîãðàììå èñïîëüçîâàíû êëàâèøè:\n\r");
            cprintf("                                                               F1 
- äàííûé Help.\n\r");
            cprintf("                                                               F2 
- ãðàììàòèêà ÿçûêà.\n\r");
            cprintf("                                                               F3 
- ÿçûê îïåðàòîðà.\n\r");
            cprintf("                                                               F4 
- êîìïèëÿöèÿ ôàéëà.\n\r");
            cprintf("                                                               ESC - âûõîä èç ïðîãðàììû.\n\n\r");
            cprintf("                          Äëÿ âûõîäà èç Help íàæìèòå ëþáóþ
êëàâèøó.");
            getch();
            }
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Ãðàììàòèêà.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
void Grammar(void)
            {
            window(10,2,70,23);
            textattr(46);
            clrscr();
            Windows(10,2,70,23,"Grammar");
            window(12,4,68,22);
            cprintf("
1. <Îïåðàòîð> ->
IF(<ÀÂ>)<LABEL>,<LABEL>,<LABEL>\n\r");
            cprintf("
2. <LABEL> -> <ÖÁÇ>\n\r");
            cprintf("
3. <ÀÂ> -> T | <ÀÂ>+T | <ÀÂ>-T\n\r");
            cprintf("
4. T -> O | T*O | T/O | T**O\n\r");
            cprintf("
5. O -> (<ÀÂ>) | <Èäåíòèôèêàòîð> | <×ÏÇ>\n\r");
            cprintf("
6. <Èäåíòèôèêàòîð> -> ÁÁ\n\r");
            cprintf("
7. <ÖÁÇ> -> Ö{Ö}\n\r");
            cprintf("
8. <×ÏÇ> -> Ö{Ö}[.Ö{Ö}]\n\n\r");
            cprintf("
Óñëîâíûå îáîçíà÷åíèÿ:\n\r");
            cprintf("                                    T           
- òåðì.\n\r");
            cprintf("                                    O          
- îïåðàíä.\n\r");
            cprintf("                                    Á           
- áóêâà.\n\r");
            cprintf("                                    Ö          
- öèôðà.\n\r");
            cprintf("                                    ÖÁÇ     - öåëîå áåç çíàêà.\n\r");
            cprintf("                                    ×ÏÇ     - ÷èñëî ñ ïëàâàþùåé çàïÿòîé.\n\r");
            cprintf("                                    **         - âîçâåäåíèå â ñòåïåíü.\n\r");
            cprintf("                                    <LABEL>
- ìåòêà.\n\r");
            cprintf("                                    <ÀÂ>   - àðèôìåòè÷åñêîå âûðàæåíèå.");
            getch();
            }
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// ßçûê.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
void Language(void)
            {
            window(20,7,60,17);
            textattr(62);
            clrscr();
            Windows(20,7,60,17,"Language");
            window(22,9,58,16);
            cprintf("            IF(<ÀÂ>)
LABEL1,LABEL2,LABEL3\n\n\r");
            cprintf("
À - Àðèôìåòè÷åñêîå Âûðàæåíèå.\n\r");
            cprintf("
LABEL1,LABEL2,LABEL3 - ïåðâàÿ,âòîðàÿ è òðåòüÿ ìåòêè ñîîòâåòñòâåííî.\n\r");
            getch();
            }
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Êîìïèëÿöèÿ ïðîãðàììû.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
void Compile(void)
            {
            window(20,7,55,13);
            textattr(94);
            clrscr();
            Windows(20,7,55,13,"Compile");
            window(22,8,58,16);
            gotoxy(1,1);
            if(com!=0)
            {
            cprintf("\n\n       Ôàéë îòêîìïèëèðîâàí!");
            Beep(900,1000);
            return;
            }
            cputs("\n           Èäåò êîìïèëÿöèÿ ôàéëà.\r\n\n  Ïîæàëóéñòà, ïîäîæäèòå...");
#ifdef TEST
window(1,1,80,25);
clrscr();
#endif
            for(int
i=0;file1[i][0]!=NULL;i++)
            {
            Operator(file1[i]);
            if(l!=3
&& l!=0)
                        Error(11);
            e1++;
            e2=0;
            }
            com++;
            delay(300);
            Beep(1000,200);
            }
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Îïåðàòîð.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
void Operator(char* str)
            {
            pos=2;
            l=0;
            string[0]=NULL;
            strcpy(string,str);
            string[strlen(string)-1]=NULL;
            char
temp[3];
            temp[0]=str[0];
            temp[1]=str[1];
            temp[2]=NULL;
#ifdef TEST
puts(string);
puts(temp);
getch();
#endif
            fprintf(fl,"
¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾\n");
            fprintf(fl,"%s\n",string);
            if(strcmp(temp,"IF")!=0)
                        {
#ifdef TEST
printf("Íå íàéäåí îïåðàòîð IF.\n");
#endif
                        Error(10);
                        return;
                        }
            Scan();
            if(nx==' ')
                        Scan();
            if(nx!='(')
                        Error(7);
            if(nx==NULL)
                        {
                        Error(12);
                        Error(9);
                        return;
                        }
            AB();
            while(nx!=')'
&& nx!=NULL && nx!=' ')
                        Scan();
            if(nx!=')')
                        Error(3);
            if(nx==NULL)
                        {
                        Error(9);
                        return;
                        }
            Scan();
            if(nx==NULL)
                        {
                        Error(9);
                        return;
                        }
            if(nx==' ')
                        Scan();
            Label();
            if(nx!=',')
                        {
                        Error(5);
                        Scan();
                        }
            else
                        Scan();
            if(nx==NULL)
                        return;
            Label();
            if(nx!=',')
                        {
                        Error(5);
                        Scan();
                        }
            else
                        Scan();
            if(nx==NULL)
                        return;
            Label();
            if(nx!=NULL)
                        {
                        Error(6);
                        Scan();
                        }
            return;
            }
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Scan.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
void Scan(void)
            {
            nx=string[pos++];
#ifdef TEST
printf("Òåêóùèé ñèìâîë %c - %d.\n",nx,nx);
#endif
            fprintf(fl,"Òåêóùèé
ñèìâîë %c - %d.\n",nx,nx);
            }
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Ìåòêà.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
void Label(void)
            {
            if(ABS() ==
NO)
                        {
                        Error(8);
                        Scan();
                        }
            else
                        l++;
            }
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Öåëîå Áåç Çíàêà.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
int ABS(void)
            {
#ifdef TEST
cprintf("ABS - ïðîâåðêà íà Öåëîå Áåç Çíàêà ñ öèôðû
%c.\r\n",nx);
#endif
            fprintf(fl,"ABS
- ïðîâåðêà íà Öåëîå Áåç Çíàêà ñ öèôðû %c.\n",nx);
            if(isdigit(nx))
                        {
                        while(isdigit(nx))
                                    Scan();
                        return(YES);
                        }
            return(NO);
            }
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Àðèôìåòè÷åñêîå Âûðàæåíèå.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
int AB(void)
            {
#ifdef TEST
cprintf("AB - Ïðîâåðêà íà Àðèôìåòè÷åñêîå
Âûðàæåíèå.\r\n");
#endif
            fprintf(fl,"AB
- Ïðîâåðêà íà Àðèôìåòè÷åñêîå Âûðàæåíèå.\n");
            Scan();
if(nx==')')
            {
            Error(12);
            return(NO);
            }
            Term();
            if(nx=='+')
                        {
                        AB();
                        }
            else
if(nx=='-')
                        {
                        AB();
                        }
            if(nx==NULL)
                        return(OK);
            else
if(nx!='*' && nx!='/' && nx!=')')
                        Error(1);
            return(YES);
            }
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Òåðì.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
int Term(void)
            {
#ifdef TEST
cprintf("Term - Ïðîâåðêà íà Òåðì.\r\n");
#endif
            fprintf(fl,"Term
- Ïðîâåðêà íà Òåðì.\n");
            Operand();
            if(nx=='/')
                        {
                        Scan();
                        Term();
                        }
            else
if(nx=='*')
                        {
                        Scan();
                        if(nx=='*')
                                    {
                                    Scan();
                                    Term();
                                    }
                        else
Term();
                        }
            if(nx==NULL)
                        return(OK);
            else
if(nx!='+' && nx!='-' && nx!=')')
                        Error(2);
            return(OK);
            }
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Îïåðàíä.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
int Operand(void)
            {
#ifdef TEST
cprintf("Operand - Ïðîâåðêà íà Îïåðàíä.\r\n");
#endif
            fprintf(fl,"Operand
- Ïðîâåðêà íà Îïåðàíä.\n");
            if(nx=='(')
                        {
                        AB();
                        if(nx!=')')
                                    Error(3);
                        else
                                    {
                                    Scan();
                                    return(OK);
                                    }
                        }
            else      if(IDENT() == NO)
                        {
                        if(Float()
== NO)
                                    Error(4);
                        }
            return(OK);
            }
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Èäåíòèôèêàòîð.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
int IDENT(void)
            {
#ifdef TEST
cprintf("IDENT - Ïðîâåðêà íà Èäåíòèôèêàòîð ñ ñèìâîëà
%c.\r\n",nx);
#endif
            fprintf(fl,"IDENT
- Ïðîâåðêà íà Èäåíòèôèêàòîð ñ ñèìâîëà %c.\n",nx);
            if(isalpha(nx))
                        isdigit(nx))

            return(NO);
            }
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Îøèáêè.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
void Error(int num)
            {
            char *E[]={
                          "Îæèäàåòñÿ '+' èëè '-'.",
                          "Îæèäàåòñÿ '*','/' èëè '**'.",
                          "Îæèäàåòñÿ ).",
                          "Îæèäàåòñÿ èäåíòèôèêàòîð èëè öåëîå áåç
çíàêà.",
                          "Îòñóòñòâóåò ','.",
                          "Íå êîíåö ñòðîêè.",
                          "Îæèäàåòñÿ (.",
                          "Ìåòêà - íå öåëîå áåç çíàêà.",
                          "Îòñóòñòâóþò ìåòêè.",
                          "Íå íàéäåí îïåðàòîð IF.",
                          "Îòñóòñòâóåò ìåòêà.",
                          "Îòñóòñòâóåò AB.",
                          NULL
                          };
            sprintf(mes[e1][e2],"%s",E[num-1]);
            e2++;
#ifdef TEST
Beep(1000,100);
cprintf("Îøèáêà: %s\r\n",E[num-1]);
getch();
#endif
            fprintf(fl,"
¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾\n");
            fprintf(fl,"Îøèáêà:
%s\r\n",E[num-1]);
            }
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Float.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
int Float(void)
            {
#ifdef TEST
cprintf("FLOAT - ïðîâåðêà íà ÷èñëî ñ ïëàâàþùåé çàïÿòîé
ñ öèôðû %c.\r\n",nx);
#endif
            fprintf(fl,"FLOAT
- ïðîâåðêà íà ÷èñëî ñ ïëàâàþùåé çàïÿòîé ñ öèôðû %c.\n",nx);
            if(isdigit(nx))
                        {
                        while(isdigit(nx))
                                    Scan();
                        if(nx=='.')
                                    {
                                    Scan();
                                    while(isdigit(nx))
                                                Scan();
                                    }
                        return(YES);
                        }
            return(NO);
            }
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
// Message.
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
void Message(int x)
            {
            window(50,3,76,22);
            textattr(95);
            clrscr();
            gotoxy(1,1);
            for(int
i=0;mes[x][i][0]!=NULL;i++)
                        cprintf("%s\r\n",mes[x][i]);
            }
//¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
Ëèòåðàòóðà.
1. Êóðñ ëåêöèé ïî ñèñòåìíîìó
ïðîãðàììèðîâàíèþ.
2. Ãåðáåðò Øèëäò «C äëÿ ïðîôåññèîíàëüíûõ ïðîãðàììèñòîâ».
ðåôåðàòû Ðåêîìåíäóåì ðåôåðàòûðåôåðàòû

     
Ðåôåðàòû @2011