Simple grammar (for example in C language)

Source: Internet
Author: User

Simple Grammar ( for example in C language)

program

<program> :

External_declaration// External declaration

| Body program// function body procedure

External Declarations

<external_declaration> :

Declaration external_declaration// header File declaration External Declaration

| Function_definition external_declaration// function declaration External Declaration

| Program//Programs

Header file declaration

<declaration>:

Symbol identifier Bracket identifier bracket declaration// symbol identifier sign header file symbol /c6> header File Declaration

|type_specifier variate '; ' Declaration// data type variable header file declaration

(global variables)

|                     Type_specifier variate ( type_specifier variate, Type_specifier variate , )Program data type variable (function name) parameter program (Declaration of a custom function)

function

<function_definition> :

Type_specifier declarator// type header file declaration

Compound_statement// Mixed statement

function Body

<body> :

Identifier Bracket Body//main

|type_specifier variate '; ' data type variables ;

|initializer// initialization ,

|statement// statements, statements

Initialize

<initializer> :

Variate Initializer// initialization of variables

| Symbol Initializer// sign initialization

|unction_definition// function (function call)

Data type

<type_specifier> :

Void

|char

|int

|float

|double

// identifier header file

<identifier> :

Include

| Define

|stdio.h

|math.h

|stdlib.h

|time.h

|string.h

|main ' (') '

statements, statements

<statement> :

Judge_statement// judgment

|jump_statement// Jump character

|iteration_statement// cycle

|selection_statement// Select

Judging

<Judge_statement> :

If Body

| Body

Loops

<iteration_statement>:

While Body

| For Body

| Do Body while

| Body

Jump Character

<jump_statement> :

Continue body

|break body

|return body

|return body

|body

symbols

<symbol > :

#

|+ Bracket

|= Bracket

|-Bracket

| : Bracket

| , Bracket

| ;

| empty string

brackets

<bracket> :

(Bracket

|) Bracket

| {Bracket

|} Bracket

|< Bracket

|> Bracket

| empty string

Pointers

<pointer > :

‘*‘

| ' * ' variate// variable

variables

<variate >:

A variate

|b variate

|c variate

|.....

|z variate

Digital

<figure>

0 Figure

|

Figure

......

Figure

Simple grammar (for example in C language)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.