资源简介
c语法分析器,生成程序的语法树
分析单个文件,不支持预处理, 不解析预处理符号#

代码片段和文件信息
/* Original source code by Compilerware with tabs = 3 */
#include “c_main.h“
#include “c_parser.h“
#include “c_actions.h“
char sym[200]; //长度200
char temp[200];
#ifdef TOKEN_ACTIONS
/////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// error
int c_token_action::error (short t)
{
if (token.end == token.start) // Illegal character?
{
token.end++;
return (t); // Return zero (t should be zero).
}
// Do a symbol table lookup could be a valid keyword or constant.
return (lookup (t));
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// lookup
int c_token_action::lookup (short t) // Look for Symbol.
{
// Do a symbol-table lookup for this token.
token.sti = add_symbol (t token.start token.end);
return (symbol[token.sti].term); // Retuen terminal symbol number.
}
#endif
#ifdef PARSE_ACTIONS
/////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// goal_ (not used for testing only)
short c_parse_action::goal_ (short p)
{
short a = pact_arg[p]; // Get first argument index.
return (0);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// defterm
short c_parse_action::defterm (short p)
{
short i = pact_arg[p]; // Get first argument index.
short sti = PS [arg_numb[i]-1].sti; // Get sti for first argument.
symbol[sti].term = arg_numb [i+1]; // Set term to second argument.
return (0);
}
// defline
short c_parse_action::defline (short p)
{
//在此写行号重置的代码 it‘s good
//获取token
//char* ls = token.start;
//char* le = token.end;
//int len = -1;
//while (ls < le){
// len++;
// sym[len] = *ls;
// ls++;
//}
//sym[len+1] = 0;
//char seps[] = “# \t“;
//char *token;
//int cnt =1;
//int line_cnt=0;
//token = strtok( sym seps );
//while( token != NULL ){ //While there are tokens in “string“
// //printf( “ %s\n“ token );
// if(cnt == 1){
// line_cnt = atoi(token); //下一行
// }
// else if(cnt == 2){
// strcpy(sym token); //预处理行中所指示的文件名
// break;
// }
// token = strtok
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 10711 2012-10-17 16:39 c.grm
文件 4549 2013-04-05 15:27 c.lgr
文件 5589 2013-04-05 15:40 c_actions.cpp
文件 716 2013-04-05 15:33 c_actions.h
文件 73440 2013-04-05 15:27 c_lexer.cpp
文件 1415 2013-04-05 15:27 c_lexer.h
文件 6984 2013-04-05 15:51 c_main.cpp
文件 2478 2012-02-02 15:36 c_main.h
文件 98435 2013-04-05 16:02 c_parser.cpp
文件 10467 2013-04-05 15:38 c_parser.h
文件 4690 2013-04-05 16:03 cpr.dsp
文件 529 2013-04-05 15:48 cpr.dsw
文件 58368 2013-04-05 16:03 cpr.ncb
文件 53760 2013-04-05 16:03 cpr.opt
文件 1314 2013-04-05 16:02 cpr.plg
文件 180 2013-04-05 16:08 说明.txt
文件 225349 2013-04-05 16:02 Debug\cpr.exe
文件 14587 2013-04-05 15:56 Debug\Editor.c
文件 63169 2011-10-04 02:00 Debug\test.input.txt
目录 0 2013-04-05 16:07 Debug
----------- --------- ---------- ----- ----
636730 20
- 上一篇:arcgis规划字体库
- 下一篇:作业手写整理机械控制工程基础朱骥北答案.pdf
相关资源
- WCE注入工具
- ModelGoon-4.4.1-site.zip
- AsyncTask文件控制暂停和继续,在状态
- Visio大全模具(含Cisco、IBM等常用拓扑
- 信号奇异点Lipschitz指数计算
- 基于STM32RCT6的步进电机驱动程序
- 酒店管理系统基于Qt Creator5)
- 用友NC开发API字典
- Navicat Premium 15汉化包.zip55438
- 登录注册界面.zip48872
- 条码字体barcode128
- Rational Rose Common破解文件
- res10_300x300_ssd_iter_140000.caffemodel与dep
- scratch 第1课 翻跟斗的小猫(入门)
- stm32f407上的两个can发送和接收例程
- Scrach 欢乐狙击手.sb2
- 04741计算机网络原理知识点整理.docx(
- Wolfram Mathematica 矩阵初等变换函数(
- pscad近海风电模型 Fortran语言
- 程序员专用字体YaHei.Consolas.1.11b42517
- scratch3.0 源程序(说相声)
- AutoCAD永久去教育版破解补丁
- 开源1A锂电池充电板TP4056原理图+PCB
- m1卡 ic卡可选择扇区初始化加密软件
- TSCC.exe
- 欧姆龙CP1系列单轴定位PLC程序.cxp
- 用Beckhoff(倍福)PLC读写巴鲁夫RFID
- CVSNT 完整覆盖版防TortoiseCVS中文乱码
- pfc 使用说明.doc
- Scratch 飞机大战.sb3
评论
共有 条评论