OpenVBS - The Script Engine for the BASIC-2020 -


What?

This is a script engine for the modern BASIC powered by the Jujube core. It is compatible with VBScript and has the modern features added. In addition, the Classic-ASP layer is implemented(on the way) as a library, so you can port your website to the Linux.

How?

> oscript sample.obs
> echo "wscript.echo 123" | ./oscript

Download

[ Windows ] [ OSX ] [ Linux ] : ver.20191209

[ Source code ]

Samples

'// The "hello world"
WScript.Echo "Hello World!"
'// Handling COM object
obj = CreateObject("Scripting.Dictionary")
'// Using embedded functions
str = Trim("   A Script Engine  ")
'// Class style object
Class Animal
  Dim wing
  Function fly()
    return wing
  End Function
End Class

Extended

'// Initializing at 'dim'
Dim v = 0
'// Ternary operation
n = If i<100 Then i Else 100 End If
'// The 'GOTO' statement
@infinite
  WScript.Echo "oh my."
GoTo @infinite
'// The 'GOTO' statement for the Line Number style
10 X = 1
20 WSCRIPT.ECHO X
30 X = X + 1
40 IF X<=10 THEN GOTO 20 END IF
'// Default parameters
Function greet(name="Steve")
  WScript.Echo "Hello " & name & "!"
End Function
'// The 'Return' statement
Function add(a, b)
  return a+b
End Function
'// The Closure
self.say = Function()
  WScript.Echo "My name is " & self.name
End Function
'// Error handling
On Error GoTo Catch
  a = 1 / 0
On Error Catch
  WScript.Echo "error occurred"
On Error GoTo 0
'// The JSON Object
obj = {
  "name" : "Steve",
  "age"  : 24,
}
'// JSON Object to String
obj = { "name" : "Steve" }
str = obj()
'// String to JSON Object
obj = {}
obj() = "{ ""name"" : ""Steve"" }"
'// Increment / Decrement
a = ++i
b = i++
'// 64bit Interger
n = 9223372036854775807
'// Separated '=' operation
x = 3     '// copy or compare in situation
x := 3    '// always copy
x == 3    '// always compare
'// Optional Chaining '?.'
obj?.method()
'// Nullish Coalescing '??'
x = obj ?? errobj
'// operator '==='
if obj === "" then obj:=empty end if
'// OpenASP Engine compatible with Classic ASP
<ul>
<% i = 10 %>
<% do while i-- %>
  <li><%= i %>: <%= now %></li>
<% loop %>
</ul>
'// No need 'set' and 'call'

These words will be ignored, you don't need use such words.

'// Module Oriented System

You can extend library by so(dll).

See "GUI.cpp" to create your own library.

License

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.

© 2019 NaturalStyle PREMIUM