Anonymous user
Category:Sparkling: Difference between revisions
improved English; clarifications, corrections
(improved English; clarifications, corrections) |
|||
Line 9:
Quite a few design decisions oppose the architecture of the aforementioned languages, though. For example, in contrast with most popular scripting languages, Sparkling has two numeric types. It operates not only on floating-point numbers, but on integers as well. Operations involving both floating-point and integral operands have well-defined semantics, similar to that in C.
Another rarely seen feature is the obligation to declare each local variable used, and the lack of (implied) global variables. All local variables must be declared before they can be referred to (read or written). Undeclared names are assumed to be globals (for practical reasons, i. e. because of the lack of header files), although global objects cannot be modified (they are always constants). The goal of
== The reference implementation ==
The reference implementation is written in portable C89: "portable" in the sense that it tries to follow the ANSI C International Standard as strictly as possible. This does not mean, however, that the entire source is compatible with C++. The public API
The implementation is currently hosted on GitHub, at H2CO3/Sparkling[http://github.com/H2CO3/Sparkling].
Line 52:
== The standard library ==
Similarly to almost all modern languages, the Sparkling distribution comes with a bunch of utility and run-time support functions bundled in various "packages" of the Sparkling standard library. These packages can be loaded separately by the host program (i. e. the native environment that runs the Sparkling interpreter); in the default mode, however, all standard functions are loaded at the beginning of a Sparkling session (represented by an "SpnContext" object, from an API point of view). Library functions are not special in the sense that they are just normal native extension functions. There is one exception, though: standard library functions assume the use of the context API, and as such, they require their user info argument to point to a valid SpnContext object. This is done so that these functions can use the error reporting facilities of the virtual machine.
The currently available standard packages are:
Line 77:
== Extensibility ==
Users can write and load native extension functions with the aid of the Sparkling C API. Extension functions must be written in C (or in C++ with external C linkage), and they must follow a predefined signature, which makes it possible for the Sparkling virtual machine to
== Debugging ==
Apart from the already mentioned disassembler, the virtual machine provides a basic stack tracing feature, which can be accessed using the C API
|