❶ 一个更新sql语句说is_syn找不到在pl/sql中怎么改啊,急!!
select * from demand_task_table where is_syn='' ;运行,出错证明demand_task_table 里面is_syn没有这个字段
select d.is_syn from demand_detail d where d.id=1236;运行,出错证明demand_detail 里面is_syn没有这个字段
❷ 编译原理语法分析实验问题
错误1:在3.txt中,第二个表达式x:=2*3,在编译器里面没有对*符号进行解释,这个应补充,或者改掉*为+。
错误2:代码中出现3次类似syn==15||16的代码,我理解应该是(syn==15)||(syn==16)
改掉这两点后代码可以正常运行。
建议:写代码是一项工作,更是一个创作过程,建议你按照代码写作规范来写,这样的代码清晰易读,易于交流和纠错。
❸ 编译原理实验“C语言”检查某段C源程序中,标识符的使用是否正确,即是否先声明后使用,或
#include "stdio.h" /*定义I/O库所用的某些宏和变量*/
#include "string.h" /*定义字符串库函数*/
#include "conio.h" /*提供有关屏幕窗口操作函数*/
#include "ctype.h" /*分类函数*/
char prog[80]=,
token[8]; /*存放构成单词符号的字符串*/
char ch;
int syn, /*存放单词字符的种别码*/
n,
sum, /*存放整数型单词*/
m,p; /*p是缓冲区prog的指针,m是token的指针*/
char *rwtab[6]=;
void scaner(){
m=0;
sum=0;
for(n=0;n<8;n++)
token[n]='\0';
ch=prog[p++];
while(ch==' ')
ch=prog[p++];
if(isalpha(ch)) /*ch为字母字符*/{
while(isalpha(ch)||isdigit(ch)) /*ch 为字母字符或者数字字符*/{
token[m++]=ch;
ch=prog[p++];}
token[m++]='\0';
ch=prog[p--];
syn=10;
for(n=0;n<6;n++)
if(strcmp(token,rwtab[n])==0) /*字符串的比较*/{
syn=n+1;
break;}}
else
if(isdigit(ch)) /*ch是数字字符*/{
while(isdigit(ch)) /*ch是数字字符*/{
sum=sum*10+ch-'0';
ch=prog[p++];}
ch=prog[p--];
syn=11;}
else
switch(ch){
case'<':m=0;token[m++]=ch;ch=prog[p++];
if(ch=='>'){
syn=21;
token[m++]=ch;}
else if(ch=='='){
syn=22;
token[m++]=ch;}
else{
syn=20;
ch=prog[p--];}
break;
case'>':m=0;token[m++]=ch;ch=prog[p++];
if(ch=='='){
syn=24;
token[m++]=ch;}
else{
syn=23;
ch=prog[p--];}
break;
case':':m=0;token[m++]=ch;ch=prog[p++];
if(ch=='='){
syn=18;
token[m++]=ch;}
else{
syn=17;
ch=prog[p--];}
break;
case'+':syn=13;token[0]=ch;break;
case'-':syn=14;token[0]=ch;break;
case'*':syn=15;token[0]=ch;break;
case'/':syn=16;token[0]=ch;break;
case'=':syn=25;token[0]=ch;break;
case';':syn=26;token[0]=ch;break;
case'(':syn=27;token[0]=ch;break;
case')':syn=28;token[0]=ch;break;
case'#':syn=0;token[0]=ch;break;
default:syn=-1;}}
main()
{
printf("\n\nThe significance of the figures:\n"
"1.figures 1 to 6 said Keyword\n"
"2.figures 10 and 11 said Other indicators\n"
"3.figures 13 to 28 said Operators\n");
p=0;
printf("\nplease input string:\n");
do {
ch=getchar();
prog[p++]=ch;
}while(ch!='#');
p=0;
do{
scaner();
switch(syn){
case 11: printf("(%d,%d)\n",syn,sum);break;
case -1: printf("\n ERROR;\n");break;
default: printf("(%d,%s)\n",syn,token);
}
}while(syn!=0);
getch();
}
程序测试结果
对源程序begin x:=9: if x>9 then x:=2*x+1/3; end #的源文件,经过词法分析后输出如下图5-1所示:
具体的你在修改修改吧
❹ 编译原理课程设计-词法分析器设计(C语言)
#include"stdio.h"/*定义I/O库所用的某些宏和变量*/
#include"string.h"/*定义字符串库函数*/
#include"conio.h"/*提供有关屏幕窗口操作函数*/
#include"ctype.h"/*分类函数*/
charprog[80]={'