Scrigroup - Documente si articole

Username / Parola inexistente      

Home Documente Upload Resurse Alte limbi doc  

CATEGORII DOCUMENTE





AccessAdobe photoshopAlgoritmiAutocadBaze de dateCC sharp
CalculatoareCorel drawDot netExcelFox proFrontpageHardware
HtmlInternetJavaLinuxMatlabMs dosPascal
PhpPower pointRetele calculatoareSqlTutorialsWebdesignWindows
WordXml


Un memento al sintaxei limbajului C

c

+ Font mai mare | - Font mai mic






DOCUMENTE SIMILARE

Trimite pe Messenger
Conversii de format in memorie
Tratarea parametrilor din linia de comanda
Operatori logici la nivel de bit
Probleme rezolvate in C la informatica
Uniuni
Operatori aritmetici
Apelul si revenirea dintr-o functie
Tipuri de structuri de date - Tablouri
Operatori
Modularizarea programelor

TERMENI importanti pentru acest document

Unmementoal  sintaxeilimbajului C

Sintaxalimbajului  C



In descrierea sintaxei limbajului vom folosi urmatoarele notatii:

a)::=cu semnificatia'prin definitie este';

b)   ½   pentru a separa alternativele unei definitii  sintactice;

c)< > pentru definirea unor metavariabile;

d)[ ]   pentru delimitarea elementelor optionale;

e)..     pentru a indica elementele care se pot repeta.

Exemplu: Pentru a defini un 'intreg_zecimal' ca o succesiunede cifre semnificative vom scrie:

<Intreg_zecimal> ::= <Cifra_nenula> [<Cifra>] ..

A. Atomi lexicali

<Cuvinte_cheie> ::= auto½break½case½char½const½continue½default½do½double| else½enum½

                                 extern½float½for½goto½if½int|long½register | return½short½signed½sizeof½

                                 static | struct½ switch½typedef½union½unsigned½void½volatile½while

<Nume> ::=<Litera>[<Litera>½<Cifra>] ..

<Litera> ::= a½b½c½d½e½f½g½h½i½j½k½l½m½n½o½p½q½r½s½t½u½v½w½x½y½z½

                   A½B½C½D½E½F½G½H½I½J½K½L½M½N½O½P½Q½R½S ½T½U½V½W½X½Y½Z½_

<Cifra> ::=0½1½2½3½4½5½6½7½8½9

<Constanta> ::=<Constanta_intreaga>½<Constanta_reala>½

                             <Constanta_enumerare>½<Constanta_caracter>

<Constanta_intreaga> ::= <Numar_intreg>[<Sufix_intreg>

<Numar_intreg> ::= <Intreg_zecimal>½<Intreg_hexazecimal>½<Intreg_octal>

<Intreg_zecimal> ::= <Cifra_nenula>[<Cifra>] ..

<Cifra_nenula> ::= 1½2½3½4½5½6½7½8½9

<Intreg_hexazecimal> ::= 0x<Cifra_hexa> ..

<Cifra_hexa> ::= <Cifra>½a½b½c½d½e½f½A½B½C½D½E½F

<Intreg_octal> ::= 0[<Cifra_octala>] ..

<Cifra_octala> ::= 0½1½2½3½4½5½6½7

<Sufix_intreg> ::= <Sufix_unsigned>[<Sufix_long>]½<Sufix_long>[<Sufix_unsigned>]

<Sufix_unsigned> ::= U½u

<Sufix_long> ::= L½l

<Constanta_reala> ::= <Constanta_fract>[<Exponent>][<Sufix_real>]½

                                    <Cifra> .. <Exponent>[<Sufix_real>]

<Constanta_fract> ::=[<Cifra>] .. . <Cifra>..½<Cifra>.. .

<Exponent> ::= E½e½[+½-]½<Cifra> ..

<Sufix_real> ::= F½f½L½l

<Constanta_enumerare> ::= <Nume>

<Constanta_caracter>::=  '<Caracter_C> ..'½L'<Caracter_C>'

<Caracter_C> ::= <Orice_caracter_tiparibil_cu exceptia: ' êi > ½        

½'½?½½a½b½f½n½r½t½v½

                                      <Cifra_octala>[<Cifra_octala>[<Cifra_octala>]]½

                                       x<Cifra_hexa> ..

<Sir_de_caractere> ::= '[<Caracter_S> ..]'

<Caracter_S> ::= <Orice_caracter_tiparibil_cu exceptia: ' si>½<Secventa_escape>

<Operatori_si_semne_de_punctuatie >::=     +½-½*½/½%½^½&½~½!½=½->½+=½-=½*=½

                                                                    /=½%=½^=½&=½!=½<<½>>½<<=½>>=½= =½<=½

                                                                    >=½<½>½&&½!!½++½--½,½()½[]½½;½?½:½




B. Declaratii

<Unitate_de_compilare> ::= <O_declaratie> ..

<O_declaratie> ::= <Def_functie>½<Declaratie>;

<Declaratie> ::= [<Specificatori>][<Lista_declaratori>]

<Specificatori> ::= <Specificator> ..

<Specificator> ::= <Clasa_memorare>½<Tip>½typedef

<Clasa_memorare> ::= auto½register½static½extern

<Tip> ::= <Tip_simplu>½<Nume_typedef>½<Calificator>½

   <Descriere_tip_enumerare>½<Descriere_tip_neomogen>

<Tip_simplu> ::= char½short½int½long½signed½unsigned½float½double½ void

<Nume_typedef> ::=    <Nume>

<Descriere_tip_enumerare> ::= enum<Nume>½enum[<Nume>]

<Lista_enum> ::= <Enumerator>[,<Enumerator>] ..

<Enumerator> ::= <Nume>[=<Expr_constant_>

<Tip_neomogen> ::= struct½union

<Lista_campuri> ::=    <Decl_campuri>;[<Decl_campuri>;] ..

<Decl_campuri> ::=    [<Specificatori>][<Camp>[,<Camp>] ..]

<Camp> ::= <Declarator>½[<Nume>]:<Expr_constanta>

<Lista_declaratori> ::= <Decl_init>[,<Decl_init>] ..

<Decl_init> ::= <Declarator>[<Iniïializare>]

<Declarator> ::= [<Indirect>..]<Denumire>[<Decl_F_T>]

<Indirect> ::=  *[<Calificator> ..]

<Denumire> ::= <Nume>½(<Declarator>)

<Decl_F_T> ::= ([<L_declar_par>])½<Decl_tablou> ..

<Decl_tablou> ::= []½[<Expr_constanta>]

<L_declar_par> ::= <Decl_par>[,<Decl_par>] .. [, ..]

<Decl_par> ::= <Tip>..<Declarator>½<Decl_tip>

<Decl_tip> ::= <Tip>..[<Indirect>..][(<Decl_tip>)][<Decl_F_T>]

<Initializare> ::=   =<Expr>½ =

<Lista_init>::=<Expr>[,<Lista_init> ..½[,<Lista_init>] ..

<Def_functie> ::= [<Specif_functie> ..]<Declarator>[<Declaratie>;] ..½<Bloc>

<Specif_functie> ::=    extern½static½<Tip>

C. Expresii

<Expr> ::= <Expresie>[,<Expresie>] ..

<Expresie> ::= <Expr_conditionala>|<Expr_unara><Oper_atribuire><Expresie>

<Oper_atribuire> ::= +½*=½/=½%=½+=½-=½<<=½>>=½&=½^=½!=

<Expr_conditionala> ::= <Expr_SAU_logic>½

                                        <Expr_SAU_logic> ? <Expr> : <Expr_conditionala>

<Expr_SAU_logic> ::= <Expr_SI_logic>½<Expr_SAU_logic> !! <Expr_SI_logic>

<Expr_SI_logic> ::=    <Expr_SAU>½<Expr_SI_logic> && <Expr_SAU>

<Expr_SAU> ::= <Expr_SAU_exclusiv>½<Expr_SAU><Expr_SAU_exclusiv>

      

<Expr_SAU_exclusiv> ::= <Expr_SI>½<Expr_SAU_exclusiv> ^ <Expr_SI>

<Expr_SI> ::= <Expr_egalitate>½<Expr_SI> & <Expr_egalitate>

<Expr_egalitate> ::= <Expr_relaïionala>½<Expr_egalitate>==Expr_relationala>½

                                   <Expr_egalitate> != <Expr_relationala>

<Expr_relationala> ::= <Expr_deplasare>½ <Expr_relationala><<Expr_deplasare>½

                                                                       <Expr_relationala>>  <Expr_deplasare>½

                                                                       <Expr_relationala> <= <Expr_deplasare>½

                                                                       <Expr_relationala> >= <Expr_deplasare>½

<Expr_deplasare> ::= <Expr_aditiva>½ <Expr_deplasare><<<Expr_aditiva>½

                                                                <Expr_deplasare>>><Expr_aditiva>½

<Expr_aditiva> ::= <Expr_multiplicativa>½<Expr_aditiva>+ <Expr_multiplicativa>½

                                                                     <Expr_aditiva>- <Expr_multiplicativa>½

<Expr_multiplicativa>::=        <Expr_multiplicativa>*  <Expr_prefixata>½

                                               <Expr_multiplicativa>   / <Expr_prefixata>½

                                                <Expr_multiplicativa>% <Expr_prefixata>

<Expr_prefixata> ::= <Expr_unara>½(<Decl_tip>)<Expr_prefixata>

<Expr_unara> ::= <Expr_postfixata>½<Op_unar><Expr_prefixata>½

                               ++<Expr_unara>½ --<Expr_unara>½sizeof<Expr_unara>½

                               sizeof(<Decl_tip>)

<Op_unar> ::= &½*½+½-½~½!

<Expr_postfixata> ::= <Termen>½<Expr_postfixata>[<Expr>]½

                        <Expr_postfixata>(<Lista_Expresii>)½ <Expr_postfixata> . <Nume>½

                        <Expr_postfixata> -> <Nume>½<Expr_postfixata> ++ ½<Expr_postfixata>--

<Termen> ::=<Nume>½<Constanta>½<Sir_de_caractere>½(<Expr>)

<Lista_Expresii> ::=[<Expr>] ..

<Expr_constanta> ::= <Expr_conditionala>

D. Instructiuni

<Instr>::= <Instr_etichetata>½<Instr_compusa>½ <Instr_expresie>½Instr_de_selectie>½

      <Instr_de_ciclare>½<Instr_de_salt>

<Instr_etichetata> ::= <Nume>:<Instr>½case <Expr_constanta

<Instr_expresie> ::=[<Expr>];

<Instr_de_selectie> ::= if (<Expr>) <Instr>½if (<Expr>) <Instr> else <Instr>½

                                      switch (<Expr>) <Instr>

<Instr_de_ciclare> ::= while (<Expr>)<Instr>;½

                                    do <Instr> while (<Expr>);½

                                    for ( [<Expr>];[<Expr>];[<Expr>] ) [<Instr>];

<Instr_de_salt> ::= goto <Nume>;½continue;½break;½return [<Expr>];








Politica de confidentialitate

DISTRIBUIE DOCUMENTUL

Comentarii


Vizualizari: 335
Importanta: rank

Comenteaza documentul:

Te rugam sa te autentifici sau sa iti faci cont pentru a putea comenta

Creaza cont nou

Termeni si conditii de utilizare | Contact
© SCRIGROUP 2019 . All rights reserved

Distribuie URL

Adauga cod HTML in site