Virtual Machine (sgsvm)
This is the default standalone environment for SGScript, useful for running scripts in a portable way.
Command line syntax
sgsvm [files|options] sgsvm [options] -p|--program <srcname>[, <arguments>]
Options
-h
,--help
: print help text, displaying command line syntax-v
,--version
: print version info-s
,--separate
: restart the engine between scripts-d
,--debug
: enable interactive debugging on errors-p
,--program
: translate the following arguments into a SGS program call--stats
: print VM stats after running the scripts- prints number of allocations, frees, memory blocks and size, object count, GC state
--profile
: enable profiling by collecting call stack timings--profile-ops
: enable low-level VM instruction profiling--profile-mem
: enable memory usage profiling
Example usage
sgsvm -d -p appMain param=1
- run applicationappMain
with debugging, passing argument 'param=1'sgsvm one.sgs two.sgs
- run fileone.sgs
, followed bytwo.sgs
, in the same environment
Additional info
- Program mode defines global
argc
andargv
variables, generated from arguments after the flag. - It is possible to execute multiple files, this is so that environment could be prepared by one file and used by another one.
- Profilers dump their data to standard output before freeing the engine (after end of each separately executed script or at the end of all scripts).