求win8 c语言编译器

// locates identifier in symbol table.

VS Express 2013 微软网站上就可以下,免费不用

在线编译器c语言 c语言编译器在线编译在线编译器c语言 c语言编译器在线编译


在线编译器c语言 c语言编译器在线编译


gccswitch (i.f) vs20term(set);13

上msdn看看吧,vs2013

gcc for windows cmake codeblocks vs2013 dev-C++ vs2008

求一个c语言编写的pl0编译器

if (! inset(sym, s1))

// pl0 compiler source code

#include

#include

#include

#include

#include "set.h"

#include "pl0.h"

//////////////////////////////////////////////////////////////////////

// print error message.

void error(n)

{int i;

printf(" ");

for (i = 1; i <= cc - 1; i++)

printf(" ");

fprintf(outfile, " ");

fprintf(outfile, "^n");

printf("^n");

fprintf(outfile, "Error %3d: %sn", n, err_msg[n]);

printf("Error %3d: %sn", n, err_msg[n]);

err++;

} // error

//////////////////////////////////////////////////////////////////////

void getch(void)

{if (cc == ll)

{if (feof(infile))

{printf("nPROGRAM INCOMPLETEn");

exit(1);

}ll = cc = 0;

fprintf(outfile, "%5d ", cx);

printf("%5d ", cx);

while ( (!feof(infile)) // added & modified by alex 01-02-09

&& ((ch = getc(infile)) != 'n'))

{fprintf(outfile, "%c", ch);

printf("%c", ch);

line[++ll] = ch;

fprintf(outfile, "n");

printf("n");

line[++ll] = ' ';

}ch = line[++cc];

} // getch

//////////////////////////////////////////////////////////////////////

// gets a symbol from input stream.

void getsym(void)

{int i, k;

char a[MAXIDLEN + 1];

while (c}elseh == ' '|| ch == 't')

// modified by yzhang 02-03-12,add some white space

getch();

if (isalpha(ch))

{ // symbol is a reserved word or an identifier.

k = 0;

do

{if (k < MAXIDLEN)

a[k++] = ch;

getch();

}while (isalpha(ch) || isdigit(ch));

a[k] = 0;

word[0] = id;

i = NRW;

while (strcmp(id, word[i--]));

if (++i)

sym = wsym[i]; // symbol is a reserved word

else

sym = SYM_IDENTIFIER; // symbol is an identifier

}else if (isdigit(ch))

{ // symbol is a number.

k = num = 0;

sym = SYM_NUMBER;

do

{num = num 10 + ch - '0';

k++;

getch();

}while (isdigit(ch));

if (k > MAXNUMLEN)

error(25); // The number is too great.

}else if (ch == ':')

{getch();

if (ch == '=')

{sym = SYM_BECOMES; // :=

getch();

{sym = SYM_NULL; // illegal?

else if (ch == '>')

{getch();

if (ch == '=')

{sym = SYM_GEQ; // >=

getch();

{sym = SYM_GTR; // >

else if (ch == '<')

{getch();

if (ch == '=')

{sym = SYM_LEQ; // <=

getch();

}else if (ch == '>')

{sym = SYM_NEQ; // <>

getch();

{sym = SYM_LES; // <

else

{ // other tokens

csym[0] = ch;

while (csym[i--] != ch);

if (++i)

{sym = ssym[i];

getch();

{printf("Fatal Error: Unknown character.n");

fprintf(outfile, "Fatal Error: Unknown character.n");

exit(1);

} // getsym

//////////////////////////////////////////////////////////////////////

// generates (assembles) an instruction.

void gen(int x, int y, int z)

{if (cx > CXMAX)

{fprintf(outfile, "Fatal Error: Program too long.n");

printf("Fatal Error: Program too long.n");

exit(1);

}code[cx].f = x;

code[cx].l = y;

code[cx++].a = z;

} // gen

//////////////////////////////////////////////////////////////////////

// tests if error occurs and skips all symbols that do not belongs to s1 or s2.

void test(symset s1, symset s2, int n)

{symset s;

{showset(s1);

showset(s2);

printf("sym=%d, id=%sn", sym, id);

error(n);

s = uniteset(s1, s2);

while(! inset(sym, s))

getsym();

destroyset(s);

}} // test

//////////////////////////////////////////////////////////////////////

int dx; // data allocation index

void enter(int kind)

{mask mk;

// added by yzhang 02-02-28

if ( ition(id)> 0 ){

error(26); //Redeclared identifier.

}// end

tx++;

strcpy(table[tx].name, id);

table[tx].kind = kind;

switch (kind)

{case ID_CONSTANT:

if (num > MAXADDRESS)

{error(25); // The number is too great.

}table[tx].value = num;

mk = (mask) &table[tx];

mk->ll = ll;

mk->address = dx++;

case ID_PROCEDURE:

mk = (mask) &table[tx];

mk->ll = ll;

} // switch

} // enter

//////////////////////////////////////////////////////////////////////

int ition(char id)

{int i;

strcpy(table[0].name, id);

i = tx + 1;

while (strcmp(table[--i].name, id) != 0);

return i;

} // ition

//////////////////////////////////////////////////////////////////////

void constdeclaration()

{if (sym == SYM_IDENTIFIER)

if (sym == SYM_EQU || sym == SYM_BECOMES)

{if (sym == SYM_BECOMES)

error(1); // Found ':=' when expecting '='.

getsym();

if (sym == SYM_NUMBER)

{enter(ID_CONSTANT);

getsym();

{error(2); // There must be a number to follow '='.

else

{error(3); // There must be an '=' to follow the identifier.

else //added by yzhang 02-02-28

error(4); // There must be an identifier to follow 'const', 'var', or 'procedure'.

} // constdeclaration

//////////////////////////////////////////////////////////////////////

{if (sym == SYM_IDENTIFIER)

{enter(ID_VARIABLE);

getsym();

{error(4); // There must be an identifier to follow 'const', 'var', or 'procedure'.

}} // vardeclaration

//////////////////////////////////////////////////////////////////////

void listcode(int from, int to)

{int i;

printf("n");

fprintf(outfile, "n");

for (i = from; i < to; i++)

{printf("%5d %st%dt%dn", i, mnemonic[code[i].f], code[i].l, code[i].a);

fprintf(outfile, "%5d %st%dt%dn", i, mnemonic[code[i].f], code[i].l, code[i].a);

}printf("n");

fprintf(outfile, "n");

} // listcode

//////////////////////////////////////////////////////////////////////

void factor(symset fsys)

{void expression();

int i;

test(facbegsys, fsys, 24); // The symbol can not be as the beginning of an expression.

while (inset(sym, facbegsys))

{if (sym == SYM_IDENTIFIER)

{error(11); // Undeclared identifier.

{switch (table[i].kind)

{mask mk;

gen(LIT, 0, table[i].value);

mk = (mask) &table[i];

gen(LOD, ll - mk->ll, mk->address);

case ID_PROCEDURE:

error(21); // Procedure identifier can not be in an expression.

} // switch

}getsym();

}else if (sym == SYM_NUMBER)

{if (num > MAXADDRESS)

{error(25); // The number is too great.

}gen(LIT, 0, num);

getsym();

}else if (sym == SYM_LPAREN)

set = uniteset(createset(SYM_RPAREN, SYM_NULL), fsys);

expression(set);

destroyset(set);

if (sym == SYM_RPAREN)

{error(22); // Missing ')'.

else // added by yzhang 02-02-28

test(fsys, createset(SYM_LPAREN, SYM_NULL), 23);

} // factor

//////////////////////////////////////////////////////////////////////

void term(symset fsys)

{int mulop;

set = uniteset(fsys, createset(SYM_TIMES, SYM_SLASH, SYM_NULL));

factor(set);

while (sym == SYM_TIMES || sym == SYM_SLASH)

{mulop = sym;

getsym();

factor(set);

{gen(OPR, 0, OPR_MUL);

{gen(OPR, 0, OPR_DIV);

}} // while

destroyset(set);

} // term

//////////////////////////////////////////////////////////////////////

void expression(symset fsys)

{int addop;

set = uniteset(fsys, createset(SYM_PLUS, SYM_MINUS, SYM_NULL));

if (sym == SYM_PLUS || sym == SYM_MINUS)

{addop = sym;

getsym();

if (addop == SYM_MINUS)

{gen(OPR, 0, OPR_NEG);

else

{term(set);

}while (sym == SYM_PLUS || sym == SYM_MINUS)

{addop = sym;

getsym();

if (addop == SYM_PLUS)

{gen(OPR, 0, OPR_ADD);

{gen(OPR, 0, OPR_MIN);

}} // while

destroyset(set);

} // expression

//////////////////////////////////////////////////////////////////////

void condition(symset fsys)

{int relop;

if (sym == SYM_ODD)

expression(fsys);

gen(OPR, 0, 6);

{set = uniteset(relset, fsys);

expression(set);

destroyset(set);

if (! inset(sym, relset))

{error(20);

{relop = sym;

getsym();

expression(fsys);

switch (relop)

{case SYM_EQU:

gen(OPR, 0, OPR_EQU);

case SYM_NEQ:

gen(OPR, 0, OPR_NEQ);

case SYM_LES:

gen(OPR, 0, OPR_LES);

case SYM_GEQ:

gen(OPR, 0, OPR_GEQ);

case SYM_GTR:

gen(OPR, 0, OPR_GTR);

case SYM_LEQ:

} // switch

} // else

} // else

} // condition

//////////////////////////////////////////////////////////////////////

void statement(symset fsys)

{int i, cx1, cx2;

symset set1, set;

if (sym == SYM_IDENTIFIER)

{ // variable assignment

mask mk;

if (! (i = ition(id)))

{error(11); // Undeclared identifier.

}else if (table[i].kind != ID_VARIABLE)

{error(12); // Illegal assignment.

i = 0;

}getsym();

if (sym == SYM_BECOMES)

{error(13); // ':=' expected.

}expression(fsys);

mk = (mask) &table[i];

if (i)

{gen(STO, ll - mk->ll, mk->address);

else if (sym == SYM_CALL)

{ // procedure call

getsym();

if (sym != SYM_IDENTIFIER)

{error(14); // There must be an identifier to follow the 'call'.

{if (! (i = ition(id)))

{error(11); // Undeclared identifier.

{mask mk;

mk = (mask) &table[i];

gen(CAL, ll - mk->ll, mk->address);

{error(15); // A constant or variable can not be called.

}getsym();

} // else

}else if (sym == SYM_IF)

{ // if statement

getsym();

set1 = createset(SYM_THEN, SYM_DO, SYM_NULL);

set = uniteset(set1, fsys);

condition(set);

destroyset(set1);

destroyset(set);

if (sym == SYM_THEN)

{error(16); // 'then' expected.

}cx1 = cx;

gen(JPC, 0, 0);

statement(fsys);

code[cx1].a = cx;

}else if (sym == SYM_BEGIN)

getsym();

set1 = createset(SYM_SEMICOLON, SYM_END, SYM_NULL);

set = uniteset(set1, fsys);

statement(set);

while (sym == SYM_SEMICOLON || inset(sym, statbegsys))

{if (sym == SYM_SEMICOLON)

{error(10);

}statement(set);

destroyset(set1);

destroyset(set);

if (sym == SYM_END)

{error(17); // ';' or 'end' expected.

else if (sym == SYM_WHILE)

{ // while statement

cx1 = cx;

getsym();

set1 = createset(SYM_DO, SYM_NULL);

set = uniteset(set1, fsys);

condition(set);

destroyset(set1);

destroyset(set);

cx2 = cx;

gen(JPC, 0, 0);

if (sym == SYM_DO)

{error(18); // 'do' expected.

}statement(fsys);

gen(JMP, 0, cx1);

code[cx2].a = cx;

}else //added by yzhang 02-02-28

} // statement

//////////////////////////////////////////////////////////////////////

void block(symset fsys)

{int cx0; // initial code index

mask mk;

int block_dx;

int sedTx;

symset set1, set;

dx = 3;

block_dx = dx;

mk = (mask) &table[tx];

mk->address = cx;

gen(JMP, 0, 0);

if (ll > MAXLEVEL)

{error(32); // There are too many lls.

}do

{if (sym == SYM_CONST)

{ // constant declarations

getsym();

do

{constdeclaration();

while (sym == SYM_COMMA)

constdeclaration();

}if (sym == SYM_SEMICOLON)

{error(5); // Missing ',' or ';'.

while (sym == SYM_IDENTIFIER);

} // if

if (sym == SYM_VAR)

{ // variable declarations

getsym();

do

{vardeclaration();

while (sym == SYM_COMMA)

vardeclaration();

}if (sym == SYM_SEMICOLON)

{error(5); // Missing ',' or ';'.

while (sym == SYM_IDENTIFIER);

block_dx = dx; // modified by yzhang 02-03-15

} // if

while (sym == SYM_PROCEDURE)

{ // procedure declarations

getsym();

if (sym == SYM_IDENTIFIER)

getsym();

{error(4); // There must be an identifier to follow 'const', 'var', or 'procedure'.

}if (sym == SYM_SEMICOLON)

{error(5); // Missing ',' or ';'.

}ll++;

sedTx = tx;

set1 = createset(SYM_SEMICOLON, SYM_NULL);

set = uniteset(set1, fsys);

destroyset(set1);

destroyset(set);

tx = sedTx;

ll--;

if (sym == SYM_SEMICOLON)

set1 = createset(SYM_IDENTIFIER, SYM_PROCEDURE, SYM_NULL);

set = uniteset(statbegsys, set1);

test(set, fsys, 6);

destroyset(set1);

destroyset(set);

{error(5); // Missing ',' or ';'.

}} // while

set1 = createset(SYM_IDENTIFIER, SYM_NULL);

set = uniteset(statbegsys, set1);

test(set, declbegsys, 7);

destroyset(set1);

destroyset(set);

}while (inset(sym, declbegsys));

code[mk->address].a = cx;

mk->address = cx;

cx0 = cx;

gen(INT, 0, block_dx);

set1 = createset(SYM_SEMICOLON, SYM_END, SYM_NULL);

set = uniteset(set1, fsys);

statement(set);

destroyset(set1);

destroyset(set);

gen(OPR, 0, OPR_RET); // return

test(fsys, phi, 8); // test for error: Follow the statement is an incorrect symbol.

listcode(cx0, cx);

} // block

//////////////////////////////////////////////////////////////////////

int base(int stack[], int currentLl, int llDiff)

{int b = currentLl;

while (llDiff--)

b = stack[b];

return b;

} // base

//////////////////////////////////////////////////////////////////////

// interprets and executes codes.

void interpret()

{int pc; // program counter

int stack[STACKSIZE];

int top; // top of stack

int b; // program, base, and top-stack register

instruction i; // instruction register

printf("Begin executing PL/0 program.n");

fprintf(outfile, "Begin executing PL/0 program.n");

pc = 0;

b = 1;

top = 3;

stack[1] = stack[2] = stack[3] = 0;

do

{i = code[pc++];

{case LIT:

stack[++top] = i.a;

case OPR:

switch (i.a) // operator

{case OPR_RET:

top = b - 1;

pc = stack[top + 3];

b = stack[top + 2];

case OPR_NEG:

stack[top] = -stack[top];

case OPR_ADD:

top--;

stack[top] += stack[top + 1];

case OPR_MIN:

top--;

stack[top] -= stack[top + 1];

case OPR_MUL:

top--;

stack[top] = stack[top + 1];

case OPR_DIV:

top--;

if (stack[top + 1] == 0)

{fprintf(stderr, "Runtime Error: Divided by zero.n");

fprintf(stderr, "Program terminated.n");

continue;

}stack[top] /= stack[top + 1];

case OPR_ODD:

stack[top] %= 2;

case OPR_EQU:

top--;

stack[top] = stack[top] == stack[top + 1];

case OPR_NEQ:

top--;

stack[top] = stack[top] != stack[top + 1];

case OPR_LES:

top--;

stack[top] = stack[top] < stack[top + 1];

case OPR_GEQ:

top--;

stack[top] = stack[top] >= stack[top + 1];

case OPR_GTR:

top--;

stack[top] = stack[top] > stack[top + 1];

case OPR_LEQ:

top--;

stack[top] = stack[top] <= stack[top + 1];

} // switch

case LOD:

stack[++top] = stack[base(stack, b, i.l) + i.a];

case STO:

stack[base(stack, b, i.l) + i.a] = stack[top];

//printf("%dn", stack[top]);

fprintf(outfile, "%dn", stack[top]);

top--;

case CAL:

stack[top + 1] = base(stack, b, i.l);

// generate new block mark

stack[top + 2] = b;

stack[top + 3] = pc;

b = top + 1;

pc = i.a;

case INT:

top += i.a;

case JMP:

pc = i.a;

case JPC:

if (stack[top] == 0)

pc = i.a;

top--;

} // switch

}while (pc);

//printf("End executing PL/0 program.n");

fprintf(outfile, "End executing PL/0 program.n");

//////////////////////////////////////////////////////////////////////

void main ()

{FILE hbin;

char s[80],finddot;

int i;

symset set, set1, set2;

printf("Please input source file name: "); // get file name to be compiled

scanf("%s", s);

if ((infile = fopen(s, "r")) == NULL)

{printf("File %s can't be opened.n", s);

exit(1);

}#if 1 // added by yzhang 02-02-28

// open the output file

finddot = strchr(s,'.');

if (finddot!=NULL){

strcpy(finddot, ".out");

}else{

strcat(s, ".out");

printf("%sn", s);

}printf("Output File is %sn", s);

if ((outfile = fopen(s, "w")) == NULL)

{printf("File %s can't be opened.n", s);

exit(1);

}#endif

phi = createset(SYM_NULL);

relset = createset(SYM_EQU, SYM_NEQ, SYM_LES, SYM_LEQ, SYM_GTR, SYM_GEQ, SYM_NULL);

// create begin symbol sets

declbegsys = createset(SYM_CONST, SYM_VAR, SYM_PROCEDURE, SYM_NULL);

statbegsys = createset(SYM_BEGIN, SYM_CALL, SYM_IF, SYM_WHILE, SYM_NULL);

facbegsys = createset(SYM_IDENTIFIER, SYM_NUMBER, SYM_LPAREN, SYM_NULL);

err = cc = cx = ll = 0; // initialize global variables

ch = ' ';

kk = MAXIDLEN;

getsym();

set1 = createset(SYM_PERIOD, SYM_NULL);

set2 = uniteset(declbegsys, statbegsys);

set = uniteset(set1, set2);

destroyset(set1);

destroyset(set2);

destroyset(set);

destroyset(phi);

destroyset(relset);

destroyset(declbegbreak;sys);

destroyset(statbegsys);

destroyset(facbegsys);

if (sym != SYM_PERIOD)

error(9); // '.' expected.

if (err == 0)

{hbin = fopen("hbin.txt", "w");

for (i = 0; i < cx; i++)

fwrite(&code[i], sizeof(instruction), 1, hbin);

fclose(hbin);

}if (err == 0)

interpret();

else

printf("There are %d error(s) in PL/0 program.n", err);

listcode(0, cx);

fclose(outfile);

} // main

//////////////////////////////////////////////////////////////////////

// eof pl0.c

目前主流的C语言编译软件是什么

void vardeclaration(void)

C语言相比其他很多新兴的、复杂的语言,语法还是简单一些,较好实现的。

case ID_VARIABLE:

这里列举几个主流的:

GCC

毫无疑问,GCC几乎是unix及linux系统中通用的编译器套件,几乎所有的linux发行版都预装了GCC作为C语言的默认编译器。除了对C语言的支持,GCC还支持C++、Objective-C等多种语言。GCC早在1987就由 Richard Stallman作为GNU的一部分发布。

Clang

Clang是近几年新兴的C/C++以及Objective-C的编译器,Apple是其主要投资者,其初的开发者已加盟Apple。虽说是新兴,但其对C/C++标准的支持不亚于GCC等老牌编译器,并且外部接口和GCC完全兼容,并且因其模块化、错误提示完善等优点已经越来越受到重视。一些如FreeBSD等项目已将clang作为默认编译器。

Microsoft Visual C++

作为拥有可视化集成编程系统的编译器,VC被很多使用Windows作为开发环境的初学者使用。详见百度百科的介绍

应该没什么主流,看个人选择吧

不过我用Dev-C++ 。

这是一个Windows环境下C/C++开发工具,它是一款自由软件。

这一款软件也是比较小巧,我个人也很喜欢。ctrl+F9编译,ctrl+F10执行。

Keil uVision4是现在普遍应用在单片机C程序编译的软件. Microsoft Visual Studio 是Windows系统比较常用的C语言编程,}else if (table[i].kind == ID_PROCEDURE) 调试和编译软件.

vc++ 6.0比较老 但是适合初学者学习 初学者足够了

vs 2010 、vs 2012不错, 软件稍大,

eclipse 也可以 不过不太常用

如果是初学者建议 vc++6.0 或者 vs 2012

支持Dec C,vc6.0对c语言的支持率不高,可能会出现语确而编译报错的情况,Dev C虽然也有,但要少一些,而且作简单,不需建工程,适合初学者使用。

windows下C语言编译器

{if ((i = ition(id)) == 0)

c-free很好用,可以编译C和C++程序,而且支持中文,但因为默认是C++,所以编写C语言程序的时候要记得写扩展名.c

个人觉得vc6.0不错,如果单纯是C的话其实tc2.0就很好很强大啊i = NSYM;!

主流就是viscase ID_CONSTANT:ual studio

求c语言编译器及使用方法!!新手!!

symset set;

编译器有很多种,下面介绍两种

1。turbo c 比较实用的编译器

按f10,用方向键选择左边file,点回车键出现下拉菜单,选择个,把里面的内容全删了然后输入x:(x为源文件所在盘),找到源文件,回车键打开。

然后再按f10,选择run或单击r运行,或者直接按f9编译,编译后的文件在turbo c 所在文件夹的 out} // while put文件夹里面。

2。visual c++事实上这不只是单纯的num = 0;编译器,应该说是开发环境,但包含有编译功能,直接鼠标作就可以了。

Visual C++就可以了,IDE的简单好用

编译器,GCC

安装mingw或者cygwin之后 gcc 文件名 即可

如何用c语言编译器判断三角形是否存在

其实Clang并不是一个完整的编译器,而是作为同一批开发者开发的另一个备受关注的虚拟机(类似于JVM)的llvm的一个前端开发,只是负责将C语言源码编译为llvm IR的中间语言,再由llvm编译为目标代码,这样做可以让其可移植性更好。

需要准备的材料分别有:电脑、C语言编译器。

break;

1、首先,打开C语言编译器,新建一个初始.cpp文件,例如:test.cpp。

2、在test.cpp文件中,输入C语言代码:。

int a, b, c;

scanf("%d%d%d", &a, &b, &c);

if ( a + b > c && a + c > b && b + c > a)

printf("block(set);能");

else

printf("不能");

return 0;

3、编译器运行test.cpp文件,此时输入3个边整数,成功输出了能不能构成三角形的判断结果。

C语言编译器那个好用有全面!!!! 还有谭浩强MP4教程 给地址

strcp// close all files, added by yzhang, 02-02-28y(id, a);

其实哪个都编译器没太大问题的(如果你是初学者)。微软c++,tobur c用来用去都是那几个。

谭浩强的MP4视屏?那么简单的哪用啥视屏啊, 看看书就行了。

对于咱们这些初学者,我建议你还是用简单的,wintc了,我当初是学的邓老师的视频教程,用的就是wintc,而且是根据谭老师的教材讲解的,讲得特别好,特别适合0基础学的,我当初就是自学完之后,考过的二级,你要的话,我可以给你发。

c语言编译器是一种什么

{ // block

c语言编译器是一种软件系统。

C语言是一种结构化语言。它层次清晰,便于按模块化方式组织程序,易于调试和维护。C语言{getsym();的表现能力和处理能力极强。它不仅具有丰富的运算符和数据类型,便于实现各类复杂的数据结构。它还可以直接访问内存的物理地址,进行位(bit)一级的{enter(ID_PROCEDURE);作。

早期的C语言主要是用于UNIX系统。由于C语言的强大功能和各方面的优点逐渐为人们认识,到了八十年代,C开始进入其它作系统,并很快在各类大、中、小和计算机上得到了广泛的使用。成为当代秀的程序设计语言之一。

C语言编写简单的C语言编译器?急!谢谢大家

fclose(infile);

不太理解LZ说什么,黑框里是输入a的值还是a值还有公式

test(fsys, phi, 19);

以下随便写的

main(){

int a=0;

printf("请输入一个整数:");

scanf("%d",&a);

a++;

printf("a+1=%dn",a);

}}else