没有合适的资源?快使用搜索试试~ 我知道了~
设计,编制并调试一个词法分析程序
5星 · 超过95%的资源 需积分: 10 60 下载量 49 浏览量
2011-11-08
17:53:11
上传
评论 3
收藏 3KB TXT 举报
温馨提示
试读
9页
设计,编制并调试一个词法分析程序,加深对词法分析原理的理解。主要使用C/C++语言实现。新算法,新思维。
资源推荐
资源详情
资源评论
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define LEN sizeof(struct Node)
struct Node
{
char data;
struct Node *next;
};
struct Node *head,*p;
char ch;
char *key[7]={"main","inf","char","if","else","for","while"};
char token[20];
void getch()
{
ch =p->data;
p=p->next;
}
void output(struct Node *head)
{
if(!head)
{
printf("Something wrong with head node!");
exit(1);
}
p=head->next;
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define LEN sizeof(struct Node)
struct Node
{
char data;
struct Node *next;
};
struct Node *head,*p;
char ch;
char *key[7]={"main","inf","char","if","else","for","while"};
char token[20];
void getch()
{
ch =p->data;
p=p->next;
}
void output(struct Node *head)
{
if(!head)
{
printf("Something wrong with head node!");
exit(1);
}
p=head->next;
while(p->next!=NULL)
{
printf("%c",p->data);
p=p->next;
}
printf("\n");
}
void getbc()
{
while(ch==' ')
getch();
}
void concat()
{
unsigned int i;
i=strlen(token);
token[i]=ch;
token[i+1]='\0';
}
int letter(char ch)
{
return isdigit((int)ch);
}
int digit(char ch)
{
return isdigit((int)ch);
{
printf("%c",p->data);
p=p->next;
}
printf("\n");
}
void getbc()
{
while(ch==' ')
getch();
}
void concat()
{
unsigned int i;
i=strlen(token);
token[i]=ch;
token[i+1]='\0';
}
int letter(char ch)
{
return isdigit((int)ch);
}
int digit(char ch)
{
return isdigit((int)ch);
剩余8页未读,继续阅读
资源评论
- u0108709692014-03-27不错!!能运行!
- pq09042012-07-30词法分析做的很好,稍微修改了就可用了
- miaogudu2012-12-03不错!!能运行!
- gloriazq2012-06-23词法分析做的很到位,有界面,很不错
进击的Mr.Z
- 粉丝: 2
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功