StoneLang is a flexible and powerful dynamic typed programming language
StoneLang dynamic typed language syntax draws Javascript, Python, Swift, C #, C ++ and GoLang languages such excellent characteristics. Goal is to design based on C-based syntax and both Javascript flexibility and Python convenience of a new language, so you can convenient and efficient pleasant development.
Most countries can support the language as mother tongue program development. Mother tongue is our most familiar and most popular language, through the use of native language development, so that more people have the ability to participate in the program this incredible art to realize their dreams.
Fully object-oriented design, support for multi-class methods are inherited. Draws more class inherits the design of C ++, multi-class and single-class inheritance is different, through multiple class inheritance can be more convenient integration of existing functionality. Supports the concept of interface-oriented programming, agreed greater than configuration.
Tuple defined data structure is very easy to make your development productivity more efficient.
StoneLang allows Lumbda into every corner of the program, which is designed to help you quickly batch processing of data, while reducing code redundancy.
Closures very easy to use, get rid of the shackles of various functions defined standard, allows developers to become more flexible.
Download preview version 0.2.0 inside alpha 2016/05/22
Download verify Edition (informal) 0.1.0 verify Edition 2016/01/07
Are working in research and development (see the progress/some advice)
Completed virtual machine and the intermediate code compiler, standard library and extended library program, the GC and multi-threading technology, the UNICODE and local-language programs. The standard library currently has completed the date and time, file handling, HTTP client, Cookie management, stream processing (file stream, byte stream, compressed stream), multithreading support, is currently being further improve the standard library.
import http as h var hc = new h.HttpClient() hc.get("www.baidu.com") ------------------------------------- import http select * var hc = new HttpClient() hc.get("www.baidu.com") ------------------------------------- import http select HttpClient as Client var hc = new Client() hc.get("www.baidu.com")
if gTestBytes { print("[source] " + [60, 61, 62, 63, 12580, 255, 0, 256, 257]) print(" .bytes() >> " + ([60, 61, 62, 63, 12580, 255, 0, 256, 257]).bytes()) print(bytes.detailString()) var sbytes = ("我是Jim").bytes() print("[source] " + sbytes.detailString()) print(" .length >> " + sbytes.length) print(" .asString() >> " + sbytes.asString()) print(" [0] >> " + sbytes[0]) sbytes[0] = 10 print(" [0] = 10 >> " + sbytes[0]) var sbytes_list = sbytes.split(74) print(" .split(74) >> " + sbytes_list.detailString()) sbytes.replace((100000).bytes(), 1) print(" .replace((100000).bytes(),1) >> " + sbytes.detailString()) print(" .asInt(1) >> " + sbytes.asInt(1)) print(" .startWith(10) >> " + sbytes.startWith(10)) print(" .startWith(100) >> " + sbytes.startWith(100)) print(" .endWith(109) >> " + sbytes.endWith(109)) print(" .endWith(100) >> " + sbytes.endWith(100)) print(" .contains((\"J\").bytes()) >> " + sbytes.contains(("J").bytes())) }
var sb = new util.StringBuffer() sb.append(1) sb.append("是白痴") sb.append(true) sb.append(null) sb.append("Good") print(sb.toString())
var dateTime = new DateTime() var to_string = dateTime.toString(), year = dateTime.year, month = dateTime.month, day = dateTime.day, dayOfYear = dateTime.dayOfYear, dayOfWeek = dateTime.dayOfWeek, hour = dateTime.hour, minute = dateTime.min, sec = dateTime.sec, timezone = dateTime.timezone, result_format = dateTime.format("%a,%d-%b-%y %H:%M:%S %z", true) print("[DateTime]") print("\ttoString: " + to_string) print("\tyear: " + year) print("\tmonth: " + month) print("\tday: " + day) print("\tdayOfYear: " + dayOfYear) print("\tdayOfWeek: " + dayOfWeek) print("\thour: " + hour) print("\tmin: " + minute) print("\tsec: " + sec) print("\ttimezone: " + timezone) print("") print("\tformat(%A,%d-%b-%y %H:%M:%S %z): " + result_format) dateTime.addYear(1) dateTime.addMonth(1) dateTime.addDay(1) dateTime.addHour(1) dateTime.addMin(1) dateTime.addSec(1) print("\tadded: " + dateTime)
var printURI = func(uri) { print("[URI] " + uri) print("\t uri: " + uri.uri) print("\t path: " + uri.path) print("\t root: " + uri.root) print("\t protocol: " + uri.protocol) print("\t absolute: " + uri.absolute) print("\t relative: " + uri.relative) print("\t parent: " + uri.parent) print("\t parentName: " + uri.parentName) print("\t name: " + uri.name) print("\t params: " + uri.params) } printURI(new URI("www.baidu.com")) printURI(new URI("www.baidu.com/p")) printURI(new URI("http://www.baidu.com")) printURI(new URI("http://www.baidu.com/")) printURI(new URI("http://www.baidu.com/p")) printURI(new URI("http://www.baidu.com/p/x110")) printURI(new URI("http://www.baidu.com/p/x110?name=JimStone&age=\\18"))
var printFile = (f)->{ print("[FileInfo] " + ({ name: f.name exists: f.exists path: f.path isDir: f.isDir isFile: f.isFile ext: f.ext size: f.size parent: f.parent parentName: f.parentName parentFile: f.parentFile createTime: f.createTime modifyTime: f.modifyTime accessTime: f.accessTime cime: f.cime aime: f.aime mime: f.mime mode: f.mode ino: f.ino nlink: f.nlink uid: f.uid gid: f.gid dev: f.dev rdev: f.rdev }).detailString(1)) } var file = new File("standard-module-test.sl") printFile(file) file = new File("sampleDir") print("[FileSearch] " + file) print(" .dirs() >> " + file.dirs()) print(" .files() >> " + file.files()) print(" .files(true) >> " + file.files(true)) print(" .files(\"(.*?)1\\.txt\",true) >> " + file.files("(.*?)1\\.txt", true)) var dstDir = new File("sampleDir2") print(" .copyTo('sampleDir2') >> " + file.copyTo(dstDir, true)) if dstDir.exists { print("[DstDir] " + dstDir) var bRename = dstDir.rename("sampleDir3") if bRename { dstDir.path = "sampleDir3" } print(" .rename() >> " + bRename) print(" .files(true) >> " + dstDir.files(true)) var files = dstDir.files("(.*?)1\\.txt", true) files.each(o->o.delete()) print(" files.delete() >> " + dstDir.files(true)) print(" .delete() >> " + dstDir.delete()) print(" .delete(true) >> " + dstDir.delete(true)) print(" .files(true) >> " + dstDir.files(true)) }
util.FileInputStream File input stream util.FileOutputStream File output stream util.BytesInputStream Set of bytes input stream util.BytesOutputStream Set of bytes to the output stream util.ZipInputStream Compression (zlib) packaging input stream util.ZipOutputStream Compression (zlib) Package output stream
var store = new http.CookieStore() if http_CookieStore { print(''' --------------------------- = CookieStore Test ---------------------------''') store.put("http://www.ibm.com/foo", "name=JimStone; customer=huangxp; path=/foo; domain=.ibm.com; expires=Wednesday, 19-OCT-19 23:12:40 GMT;") var cookie = store.get("http://www.ibm.com/foo") print(cookie) }
print(''' --------------------------- = HttpClient Test ---------------------------''') var client = new HttpClient() client.cookieStore = store client.autoReferer = true client.encoding = null // client.proxy = "127.0.0.1:8787" // client.headers["Accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" // client.headers["User-Agent"] = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 Safari/537.36 SE 2.X MetaSr 1.0" // store.put("http://hao123.com", "name=JimStone; customer=huangxp; path=/;") print("[headers] " + client.headers.detailString()) var repo = client.get("http://taobao.com") /* client.proxy = "127.0.0.1:8787" client.proxyType = "direct" var repo = client.get("https://www.google.jp") */ print("[current url] " + client.url) print("[http version] " + client.version) print("[response code] " + client.code) print("[response status] " + client.status) print("[response headers] " + client.repoHeaders.detailString()) print("[Content-Type] " + client.repoHeaders["Content-Type"]) if !repo.empty { var mat_title = repo.match("title>(.*?)</title") if mat_title.find() { print(("[title] {0}").fmt(mat_title.group(1))) } } print(("[content] {0}...").fmt(repo[0, 500]))
if http_util { print(''' --------------------------- = encodeURI/decodeURI Test ---------------------------''') var str = "我是唐老鸭,GuaGua?name=TangLaoYa&pos=First" print(">> string: " + str) print(">> encodeURI: " + encodeURI(str)) print(">> encodeURI: " + encodeURI(str, "GB2312")) print(">> decodeURI: " + decodeURI(encodeURI(str, "GB2312"), "GB2312")) print(''' --------------------------- = convToForm Test ---------------------------''') var dic = { name: "JimStone" age: 18 height: 172 nickname: "神之子" range: [1, 3, 5, 7, 9] } print(">> dictionary: " + dic) print(">> convToForm: " + convToForm(dic)) print(">> convToForm(GB2312): " + convToForm(dic, "GB2312")) }
wstring language; long long year; SL_PARSE("s|l", &language, &year);
if (gTestLanguage) { print("==============================") print("= Multi-based local language test ") print("==============================") var c1 = "English: I'm english" print(c1) 变量 c2 = "简体中文:我是中国人" 输出调试文本(c2) 變量 c3 = "繁體中文:我是中國人" 輸出調試文本(c3) вар c4 = "русский: я приехал из китая" печать(c4) печать() }
\r Carriage return \n Newline \t Horizontal tab \v Vertical ab \a Beep \b Back \f Feed \x Hex text (automatically converted to decimal) \o Octal text (automatically converted to decimal) \\ Backslash
Complete the loop variable scope and related definitions bytecode. Added to a virtual machine function stack frame mechanism, function, function scope, functions bytecode and run-time stack frames to complete the initial set of variable access bytecode generation, because it is pure dynamic language, so the variable portion of the access group in other types of environment-related need for access to optimize the dynamic mechanism, which is still part of the improvement, will continue to expand after the next class operation mechanism established completed.
[2/12]
Has been completed based memory pool, pooling, rapid stack (for object pooling and virtual machine stack operations) and virtual machines, GC (garbage collector) using markers and reference counting dual mechanism to ensure reliability and performance, establish a a better StoneLang bytecode definition is now complete variable definition, the definition of the cycle, arithmetic, logic operation portion bytecode interpreter through a lot of optimization work, the virtual machine's operating efficiency has gone beyond Python.
This version is the portable version of C ++, you can click here to download, Simple.txt (simple) run directory for the sample source code, you can enter the command line used to test a variety of expressions, the current version there are many problems, it is only for language tests and evidence.
StoneLang was born on January 7, 2016.
Dong Xie, English JimStone. Senior Architect, fanatical programming geeks who enjoy movies, novels, travel, violin music and games. Served in Shanghai and the British cultural competence CTO.