读书人

如何做一个basic编译器呀

发布时间: 2012-12-14 10:33:07 作者: rapoo

怎么做一个basic编译器呀?
需要代码
[解决办法]
楼主威武!在下拜服!
[解决办法]
或许你觉得这个问题很白痴,但是对于偶这个菜鸟来说很难呢。俺学计算机就一杯具来着
[解决办法]
为什么不直接用MSSCript控件呢?
[解决办法]
这个,上次看到有人用VB6做了一个VB6的IDE,包括编译器,链接工具等一系列的东西,有人下载了,可惜后来作者关了下载链接,咱去晚了
[解决办法]
下辈子 俺去开发 VB666
[解决办法]
该回复于2010-11-05 14:17:25被版主删除
[解决办法]
请参考freebasic的源代码,详见:
http://www.freebasic.net/
[解决办法]


" GNU General Public License for more details. \n"
" \n"
" You should have received a copy of the GNU General Public License \n"
" along with this program (the file is named COPYING); \n"
" if not, write to the Free Software \n"
" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. \n"
;


/* ------------- defines ---------------- */

/*
Define one and only one of the following symbols, depending on your
System:
- UNIX: uses some UNIX-features and X11
- WINDOWS: uses WIN32-features
*/


#define DONE {current=current->next;break;} /* reduces type-work */

#if defined(UNIX) && defined(WINDOWS)
UNIX and WINDOWS are defined at once; check your compiler settings
#endif


/* ------------- includes ---------------- */


#ifndef YABASIC_INCLUDED
#include "yabasic.h" /* all prototypes and structures */
#endif
#ifdef UNIX
#include <curses.h>
#endif


/* ------------- external references ---------------- */

extern int yylineno; /* current line number */
extern void switch_to_my_file(FILE *); /* switches lex input */
extern int yyparse(); /* call bison parser */


/* ------------- global variables ---------------- */

struct symbol *symroot; /* first element in symbol list */
struct symbol *symhead; /* last element ind symbol list */
struct stackentry *stackroot; /* lowest element in stack */
struct stackentry *stackhead; /* topmost element in stack */
struct command *current; /* currently executed command */
struct command *cmdroot; /* first command */
struct command *cmdhead; /* last command */
struct command *datapointer; /* current location for read-command */
int infolevel; /* controls issuing of error messages */


int errorlevel; /* highest level of error message seen til now */
int end_of_file=FALSE; /* TRUE, if end of file has been reached */
int diagnostic_count; /* number of diagnostic messages */
int note_count; /* number of notes */
int warning_count; /* number of warning messages */
int error_count; /* number of error messages */
int interactive; /* true, if commands come from stdin */
char *string; /* for trash-strings */
int labelcount=0; /* count self-generated labels */
int commandcount; /* total number of commands */
int program_state; /* state of program */
int prompted; /* TRUE, if prompt is fresh */
FILE *streams[10]; /* file streams */
FILE *cinstr; /* current stream for input */
FILE *coutstr; /* current stream for output */
char linebuffer[INBUFFLEN]; /* buffer for one line of input */
int curinized=FALSE; /* true, if curses has been initialized */
char *currchar; /* current char to read */
struct buff_chain *buffroot; /* start of sys-input buffer */
struct buff_chain **buffcurr; /* current entry in buff_chain */
int buffcount; /* number of filled buffers */
char *progname; /* name of yabasic-program */
char *explanation[cLAST_COMMAND-cFIRST_COMMAND+1]; /* explanations */
char **yabargv; /* arguments for yabasic */
int yabargc; /* number of arguments in yabargv */

/* printer-related */
FILE *printerfile=NULL; /* file to print on */
char *prfilename=NULL; /* filename to print on */
int print_to_file; /* print to file ? */


/* ------------- global variables for Graphics ---------------- */



[解决办法]
最好是用Java做的,c也不错,但是呢,关于c的偶已经做得差不多,就差Java的了,各位,能不能帮忙呢
[解决办法]
主高人!!!再下不敢言
[解决办法]
????????????????
[解决办法]
我QQ5620471
[解决办法]
问盖茨,呵呵
[解决办法]
7位QQ很牛了

引用:
我QQ5620471

[解决办法]
去Java问问
引用:
最好是用Java做的,c也不错,但是呢,关于c的偶已经做得差不多,就差Java的了,各位,能不能帮忙呢

[解决办法]
我做过一个解释器,楼主可以参考参考:
http://blog.csdn.net/sysdzw/archive/2010/04/02/5445796.aspx
------解决方案--------------------


引用:
最好是用Java做的,c也不错,但是呢,关于c的偶已经做得差不多,就差Java的了,各位,能不能帮忙呢


还是你牛,我连C的都没有:(
[解决办法]
这个问题很白痴吗?或许你们觉得没必要,但是对我来说,it's very important for me

[解决办法]
可不可以单纯围观楼主图像?
[解决办法]
ls:能不能找一找呢
[解决办法]
VB写的VB编译器,我有,但不知道存哪块硬盘里了.

读书人网 >VB

热点推荐