2010-01-18 76 views

回答

2

在PHP中找不到一个,但在Javascript中有一个:http://stevehanov.ca/blog/index.php?id=92。如果您向下滚动该页面,作者会大力解释该事情的工作原理,哪个国际海事组织是一个开始的好地方。

+0

好吧,即使它不是我正在寻找的东西,它非常酷:)谢谢。 – 2010-01-18 11:28:11

2

其实,这正是我在几个月前写道:

http://pub.32kb.org/files/entry/pBasic/pBasic.zip

它是Java中的一个文件的基本实现,叫做端口jASIC在这里找到:

http://journal.stuffwithstuff.com/2010/07/18/jasic-a-complete-interpreter-in-one-java-file

用法如下:

$pbas = new pBasic(); 
$basicScript = file_get_contents('test.bas'); 
// execute 
$pbas->interpret($basicScript); 

这是一个简单基本的脚本我用我的游戏概念:

' list all the files on the current server, by memmaker 

println ""          ' used to produce a blank line in the  output, the "" is needed for the parser 

if "bin" = arg1 then getbinaries    ' determine which directory to show 

print "Listing of/on " + _ENV_CONNECTED_SERVER 
allfiles = list_files()       ' get list of files from the system 

goto init 

getbinaries: 

print "Listing of /bin on " + _ENV_CONNECTED_SERVER 
allfiles = list_files(1)      ' get list of bin files from the system 

init: 

filecount = count(allfiles)      ' get the length of the array 

counter = 0          ' init the counter for the loop 

println " - " + filecount + " files found"  ' print the file count, note the "" prefix is needed because pBasic infers the type from the left argument of a binary operator 

println "" 

beginloop: 

println get_element(allfiles, counter)   ' output the current filename 

counter = counter + 1       ' increment the loop counter 

if counter < filecount then beginloop   ' break the loop when all files are output 

正如你所看到的,我扩大仍按原jASIC解释并添加函数调用和其他一些小的变化。

+0

这看起来很有前途,但恐怕我无法实现。任何指针? – 2013-04-20 19:56:52

+0

当然,我已经添加了上面的基本使用说明。随时与我联系,以获得进一步的问题。 – 2013-05-23 11:47:37

+0

对不起,迟到的回应。我似乎无法得到它的工作:( – 2013-10-01 20:56:10