码迷,mamicode.com
首页 > Windows程序 > 详细

A C compiler that parses this code will contain at least the following symbol table entries

时间:2017-11-22 17:37:23      阅读:224      评论:0      收藏:0      [点我收藏+]

标签:parse   ref   following   gen   generate   ram   hat   span   cal   

A C compiler that parses this code will contain at least the following symbol table entries

Consider the following program written in C:

// Declare an external function
extern double bar(double x);

// Define a public function
double foo(int count)
{
    double  sum = 0.0;

    // Sum all the values bar(1) to bar(count)
    for (int i = 1;  i <= count;  i++)
        sum += bar((double) i);
    return sum;
}

A C compiler that parses this code will contain at least the following symbol table entries:

Symbol nameTypeScope
bar function, double extern
x double function parameter
foo function, double global
count int function parameter
sum double block local
i int for-loop statement

In addition, the symbol table will also contain entries generated by the compiler for intermediate expression values (e.g., the expression that casts the i loop variable into a double, and the return value of the call to function bar()), statement labels, and so forth.

 

https://en.wikipedia.org/wiki/Symbol_table

A C compiler that parses this code will contain at least the following symbol table entries

标签:parse   ref   following   gen   generate   ram   hat   span   cal   

原文地址:http://www.cnblogs.com/feng9exe/p/7879700.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!