Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Tagged as

ObjectScript: A new programming language

, 9 Oct 2012 MIT
The ObjectScript is a new programing language that mixes benefits of JavaScript, Lua, and PHP. The ObjectScript has syntax from JavaScript, multiple results from Lua, OOP from PHP and much more.
OS-0.98-rc-noexe.ZIP
OS
examples-os
add_user_module.os
bind.os
core.os
run_os_prog.os
test.os
proj.win32
add_user_module
add_user_module.vcxproj.filters
os
os.vcxproj.filters
osbind
osbind.vcxproj.filters
profile_benchmark
profile_benchmark.vcxproj.filters
scripts
test_fannkuch.lua
test_fannkuch.os
run_os_prog
run_os_prog.vcxproj.filters
stack_usage
stack_usage.vcxproj.filters
README.md
source
os-binder-FunctionClassImp.tpl
os-binder-FunctionImp.tpl
os-binder-FunctionImpVoid.tpl
OS-0.98-rc.ZIP
bin
os.exe
add_user_module.os
bind.os
core.os
run_os_prog.os
test.os
Makefile
add_user_module.vcxproj.filters
os.vcxproj.filters
osbind.vcxproj.filters
profile_benchmark.vcxproj.filters
test_fannkuch.lua
test_fannkuch.os
run_os_prog.vcxproj.filters
stack_usage.vcxproj.filters
README.md
os-binder-FunctionClassImp.tpl
os-binder-FunctionImp.tpl
os-binder-FunctionImpVoid.tpl
unitpoint-objectscript-86f30d7-noexe.zip
unitpoint-objectscript-86f30d7
.gitignore
README.md
bin
.gitignore
examples-os
add_user_module.os
bind.os
core.os
run_os_prog.os
test.os
proj.win32
.gitignore
add_user_module
.gitignore
os
.gitignore
test_fannkuch.osc
test_fannkuch.osd
osbind
.gitignore
profile_benchmark
.gitignore
scripts
test_fannkuch.lua
test_fannkuch.os
run_os_prog
.gitignore
stack_usage
.gitignore
source
.gitignore
os-binder-FunctionClassImp.tpl
os-binder-FunctionImp.tpl
os-binder-FunctionImpVoid.tpl
unitpoint-objectscript-86f30d7.zip
.gitignore
README.md
.gitignore
os.exe
add_user_module.os
bind.os
core.os
run_os_prog.os
test.os
.gitignore
.gitignore
.gitignore
test_fannkuch.osc
test_fannkuch.osd
.gitignore
.gitignore
test_fannkuch.lua
test_fannkuch.os
.gitignore
.gitignore
.gitignore
os-binder-FunctionClassImp.tpl
os-binder-FunctionImp.tpl
os-binder-FunctionImpVoid.tpl
[FILE] ../../examples-os/add_user_module.os
[1] for(var i, s in ["123", "12w", 1234, " df", "    "]){

begin function
  begin locals, total 6
    0 _E
    1 _G
  end locals
  begin scope
    begin locals 4
      2 i
      3 s
      4 #func
      5 #valid
    end locals
    new local var i (2 0)

    new local var s (3 0)

    new local var #func (4 0 temp)

    new local var #valid (5 0 temp)

    begin code list
      begin set local var
        begin call method
          begin array 5
            begin set auto index
              push const string "123"
            end set auto index
            ,
            begin set auto index
              push const string "12w"
            end set auto index
            ,
            begin set auto index
              push const number 1234
            end set auto index
            ,
            begin set auto index
              push const string " df"
            end set auto index
            ,
            begin set auto index
              push const string "    "
            end set auto index
          end array
          begin params 1
            push const string "__iter"
          end params ret values 1
        end call method ret values 1
      end set local var #func (4 0 temp)

      begin loop
        begin set local var
          begin set local var
            begin set local var
              begin call
                get local var #func (4 0 temp)
                begin params 0
                end params ret values 0
              end call ret values 3
            end set local var s (3 0)
          end set local var i (2 0)
        end set local var #valid (5 0 temp)

        begin if
          begin bool exp
            begin logic not
              get local var #valid (5 0 temp)
            end logic not
          end bool exp
          begin then
            break
          end then
        end if ret values 0


[2] print("my.isdigit("..s..") = "my.isdigit(s)" my.hash("..s..") = "my.hash(s))

        begin scope
          begin call method
            get local var _E (0 0)
            begin params 5
              push const string "print"
              ,
              begin operator ..
                begin operator ..
                  push const string "my.isdigit("
                  get local var s (3 0)
                end operator ..
                push const string ") = "
              end operator ..
              ,
              begin call method
                get env var my
                begin params 2
                  push const string "isdigit"
                  ,
                  get local var s (3 0)
                end params ret values 2
              end call method ret values 1
              ,
              begin operator ..
                begin operator ..
                  push const string " my.hash("
                  get local var s (3 0)
                end operator ..
                push const string ") = "
              end operator ..
              ,
              begin call method
                get env var my
                begin params 2
                  push const string "hash"
                  ,
                  get local var s (3 0)
                end params ret values 2
              end call method ret values 1
            end params ret values 5
          end call method ret values 0
        end scope ret values 0
      end loop ret values 0
    end code list ret values 0
  end scope ret values 0

  begin code list
    begin return
      get local var _E (0 0)
    end return values 1
  end code list ret values 0
end function

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The MIT License

Share

About the Author

unitpoint

United States United States
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.141030.1 | Last Updated 9 Oct 2012
Article Copyright 2012 by unitpoint
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid