91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 392KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-05-25
  • 語言: C/C++
  • 標(biāo)簽:

資源簡(jiǎn)介

C 語言編譯器源代碼。包含了開發(fā)C語言編譯器的全部源文件。

資源截圖

代碼片段和文件信息

/****************************************************/
/*?File:?analyze.c??????????????????????????????????*/
/*?Semantic?analyzer?implementation */
/*?for?the?C_Minus?compiler */
/****************************************************/

#include?“globals.h“
#include?“util.h“
#include?“parse.h“
#include?“symtab.h“
#include?“analyze.h“

/*?counter?for?variable?memory?locations?*/
static?int?location?=?0;

/*?current?symble?table?*/
static?Symtab?*?pTable;
static?FunEntry?*?pFun;

/*?procedure?traverse?is?a?generic?recursive
?*?syntax?tree?traversal?routine:
?*?it?applies?preProc?in?preorder?and?postProc?
?*?in?postorder?to?tree?pointed?to?by?t
?*/
static?void?traverse(TreeNode?*?t?
?void?(*?preProc)?(TreeNode?*)
?void?(*?postProc)?(TreeNode?*))
{?
if?(t?!=?NULL)
{?
int?i;
preProc(t);
for?(i=0;?i? traverse(t->child[i]?preProc?postProc);
postProc(t);
traverse(t->sibling?preProc?postProc);
}
}

/*?nullProc?is?a?do-nothing?procedure?to?
?*?generate?preorder-only?or?postorder-only
?*?traversals?from?traverse
?*/
static?void?nullpreProc(TreeNode?*?t)
{?
if?(t?==?NULL)?return;
else?if?(t->nodekind?==?Dec)?{
switch?(t->kind.dec)
{
case?FunDefK:
pFun?=?Lookup_Fun(t->attr.name);
break;
case?CompK:
pTable?=?t->attr.table;
break;
}
}
}

static?void?nullpostProc(TreeNode?*?t)
{?
if?(t?==?NULL?||?pTable?==?NULL)?return;
else?if?(t->nodekind?==?Dec?&&?t->kind.dec?==?CompK)
pTable?=?pTable->parent;
}

/*?procedure?insertNode?inserts?
?*?identifiers?stored?in?t?into?
?*?the?symbol?table?
?*/
static?void?insertNode(TreeNode?*?t)
{?
switch?(t->nodekind)
{?
????case?Dec:
switch?(t->kind.dec)
{?
case?FunDecK:
if?(Lookup_Fun(t->attr.name)?==?NULL)
Insert_Fun(t->attr.name?t->type?t->child[0]);
break;
case?FunDefK:
if?(Lookup_Fun(t->attr.name)?==?NULL)
pFun?=?Insert_Fun(t->attr.name?t->type?t->child[0]);
break;
case?VarK:
{
ValEntry?Entry;
TreeNode?*?child;
for?(child?=?t->child[0];?child?!=?NULL;?child?=?child->sibling)?{
if?(child->nodekind?==?Exp?&&?child->kind.exp?==?IdK)?{
if?(Lookup_Var(pTable?pFun?child->attr.name?&Entry)?!=?pTable->nestlevel)
if?(child->child[0]?==?NULL)
Insert_Var(pTable?child->attr.name?t->type?1);
else
Insert_Var(pTable?child->attr.name?t->type?child->child[0]->attr.val.i);
}
else?if?(child->nodekind?==?Stmt?&&?child->kind.stmt?==?AssignK)?{
if?(Lookup_Var(pTable?pFun?child->child[0]->attr.name?&Entry)?!=?pTable->nestlevel)
if?(child->child[0]->child[0]?==?NULL)
Insert_Var(pTable?child->child[0]->attr.name?t->type?1);
else
Insert_Var(pTable?child->child[0]->attr.name?t->type?child->child[0]->child[0]->attr.val.i);
}
}
}
break;
case?CompK:
pTable?=?Createtab(pTable?pFun);
if?(pTable==NULL)

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2005-04-19?17:23??C編譯器源代碼\
?????目錄???????????0??2004-11-14?14:58??C編譯器源代碼\341722881\
?????目錄???????????0??2004-06-14?13:01??C編譯器源代碼\341722881\Debug\
?????文件???????41984??2004-06-14?14:37??C編譯器源代碼\341722881\Debug\vc60.idb
?????文件???????53248??2004-06-14?13:03??C編譯器源代碼\341722881\Debug\vc60.pdb
?????文件???????25135??2004-06-14?13:03??C編譯器源代碼\341722881\Debug\util.obj
?????文件???????13546??2004-06-14?13:03??C編譯器源代碼\341722881\Debug\symtab.obj
?????文件???????12786??2004-06-14?13:03??C編譯器源代碼\341722881\Debug\scan.obj
?????文件???????65831??2004-06-14?13:03??C編譯器源代碼\341722881\Debug\parse.obj
?????文件???????60326??2004-06-14?13:03??C編譯器源代碼\341722881\Debug\CodeGen.obj
?????文件????????7931??2004-06-14?13:03??C編譯器源代碼\341722881\Debug\C_Minus.obj
?????文件???????15185??2004-06-14?13:03??C編譯器源代碼\341722881\Debug\analyze.obj
?????文件??????299140??2004-06-14?13:03??C編譯器源代碼\341722881\Debug\C_Minus.ilk
?????文件??????249956??2004-06-14?13:03??C編譯器源代碼\341722881\Debug\C_Minus.exe
?????文件??????533504??2004-06-14?13:03??C編譯器源代碼\341722881\Debug\C_Minus.pdb
?????文件????????7926??2003-06-23?02:15??C編譯器源代碼\341722881\analyze.c
?????文件?????????578??2003-06-23?00:15??C編譯器源代碼\341722881\analyze.h
?????文件????????2027??2003-06-22?22:45??C編譯器源代碼\341722881\C_Minus.c
?????文件????????5219??2003-06-22?20:27??C編譯器源代碼\341722881\C_Minus.dsp
?????文件?????????539??2003-06-22?20:16??C編譯器源代碼\341722881\C_Minus.dsw
?????文件??????148480??2004-06-14?14:38??C編譯器源代碼\341722881\C_Minus.ncb
?????文件???????51712??2004-06-14?14:38??C編譯器源代碼\341722881\C_Minus.opt
?????文件?????????248??2004-06-14?14:37??C編譯器源代碼\341722881\C_Minus.plg
?????文件???????18369??2003-06-24?16:24??C編譯器源代碼\341722881\CodeGen.c
?????文件????????1312??2003-06-23?00:16??C編譯器源代碼\341722881\CodeGen.h
?????文件????????3413??2003-06-24?12:40??C編譯器源代碼\341722881\globals.h
?????文件?????????797??2003-06-14?01:33??C編譯器源代碼\341722881\Lex&Yacc.pgp
?????文件?????????268??2003-06-24?17:07??C編譯器源代碼\341722881\Lex&Yacc.pgw
?????文件???????44677??2003-06-24?17:07??C編譯器源代碼\341722881\parse.c
?????文件????????2052??2003-06-24?17:07??C編譯器源代碼\341722881\parse.h
?????文件???????33176??2003-06-24?17:07??C編譯器源代碼\341722881\parse.v
............此處省略10個(gè)文件信息

評(píng)論

共有 條評(píng)論

相關(guān)資源