llvm-qbasic-master

所属分类:编译器/解释器
开发工具:C/C++
文件大小:103KB
下载次数:16
上传日期:2013-07-10 18:03:41
上 传 者mudell
说明:  QBASIC编译器,用yacc、lex等生成,生成语法树(AST),自动代码生成,静态链接运行库
(llvm-qbc is a QBASIC compiler as well as an runtime library ( statically linked ).Based on yacc,)

文件列表:
CMakeLists.txt (760, 2012-12-17)
LICENSES (105, 2012-12-17)
NEWS (869, 2012-12-17)
basic.kdev4 (46, 2012-12-17)
brt (0, 2012-12-17)
brt\CMakeLists.txt (94, 2012-12-17)
brt\mm.c (1118, 2012-12-17)
brt\print.c (1096, 2012-12-17)
brt\qbarray.c (1617, 2012-12-17)
cmake (0, 2012-12-17)
cmake\CMakeLists.txt (1, 2012-12-17)
cmake\FindBISON.cmake (7762, 2012-12-17)
cmake\FindFLEX.cmake (5957, 2012-12-17)
cmake\FindLLVM.cmake (708, 2012-12-17)
compiler (0, 2012-12-17)
compiler\CMakeLists.txt (1434, 2012-12-17)
compiler\ast.cpp (3902, 2012-12-17)
compiler\ast.hpp (9862, 2012-12-17)
compiler\codegen.cpp (14514, 2012-12-17)
compiler\llvmwrapper.cpp (5515, 2012-12-17)
compiler\llvmwrapper.hpp (1218, 2012-12-17)
compiler\location.hh (5175, 2012-12-17)
compiler\main.cpp (4643, 2012-12-17)
compiler\operator.cpp (11743, 2012-12-17)
compiler\parser.cpp (59243, 2012-12-17)
compiler\parser.hpp (10113, 2012-12-17)
compiler\parser.ypp (11941, 2012-12-17)
compiler\position.hh (4923, 2012-12-17)
compiler\qbc.h (1311, 2012-12-17)
compiler\qblex.cpp (68165, 2012-12-17)
compiler\qblex.ll (7378, 2012-12-17)
compiler\stack.hh (3473, 2012-12-17)
compiler\type.cpp (12126, 2012-12-17)
compiler\type.hpp (18756, 2012-12-17)
doc (0, 2012-12-17)
doc\ast.dot (1458, 2012-12-17)
... ...

#llvm-qbc - llvm based qbasic compiler llvm-qbc is a QBASIC compiler as well as an runtime library ( statically linked ) # Why BASIC ? To answer this questions, you must ask, why not BASIC? Because there is no BASIC compiler that is cross-platform, and feature complete. And basic interpreter is even worse, you can't distribute your program unless you distribute its interpreter first, but most commercial basic interpreter had limited premit for re-distribution. Then ? Compile ? You can't even find a compiler that supports calling C functions. What can we do with basic without the help of all avalable C libraries? To make things even worse, BASIC have not standart that every compiler agree with. # goal [1] complete QBASIC support [3] pointer support [2] call C function as freely as possible [4] highly optimized [5] a builtin GUI facility # Status update [*] dymanic array support, use arraydim to use that. [*] for loop [*] string is capable of doing "+" operation [*] string literal and string variable can assign to string variable [*] deallocating function local string when the function returns [*] being able to print numbers and string literal to screen [*] compare operation [*] sub define and invoke [*] function define and invoke [*] if statement [*] while statement [*] basic mathmatical operation [*] if statement # benchmark see [ test/compare.txt https://github.com/microcai/llvm-qbasic/blob/master/test/compare.txt ] # Implementation Detail int/long is directly supported by LLVM, so , no discssiion needed. #### for the type "string": there are two types of string : C string (literal) and QBASIC string C string is an NULL-Terminated char array. you can get a C string of an QBASIC string with cstr(QBASIC string) QBASIC string is an string which has memory automantically managed by compiler. the compiler does this by calling helper functions defined in librt see [ bre/README.md ] #### for the type "array": array is an vector space managed by the compiler automantically. you can have C style array (read only) with CARRAY(array) but if you want to "write" to that array, please use another type for this kind of job: buffer. #### for the type buffer buffer is an vector byte stream managed by user program. it's infact just byte* pointer and it's allocated space. the space is fixed when you define it. to access individual byte, use [] operator. the use of buffer is only for calling C functions. the space will be automantically freed when buffer leaves the function body. there is no need to manage the memory space. the compiller automanticall call free(3) to free the space. #### user defined structure user is allow to define structures.

近期下载者

相关文件


收藏者