My favorites | Sign in
Project Home Downloads Wiki Issues
READ-ONLY: This project has been archived. For more information see this post.
Search
for
Scripting  
Script support classes and reference.
Updated Apr 14, 2012 by jackokring

The package uk.co.peopleandroid.jarvar includes classes which support the scripting engine, as well as Classes for the abstraction of the machine. A ScriptLanguage which uses these classes is included. No further types are required to make a secure simple language. Further types would help with the creation of advanced data structures with a faster access technique, but implementation simplicity and binary size is more relevant to functioning on small systems. Note that these classes are not used by the script user to write scripts, but are used by jarvar to implement a ScriptLanguage. People writing programs in the jarvar Java abstraction dialect can use them.

Blank

The blank cell. This class would be abstract except that there are uses for it to be instanced. Connected cells are used to form FIFO stacks for computation, and lists. All classes within the API excluding String and Exception extend, directly or indirectly, the class Blank, as this allows all objects within the API to be referenced by the script evaluator, and so be stackable and hence usable. Blank supports many of the static system variables, evaluation and execution concepts and anything needing to be in context easily without finding which object to use. This removes the need for a System class.

Catch

This class is a subclass of Blank, and is used for catching errors. A partial stack trace is mandatory, so that a ScriptLanguage programmer may obtain insight into the ignored code. The partial stack trace is displayed until another Screen is displayed. This may offend some programmers who wish to hide the functioning of Catch, but this can be useful for development.

Critical

This class is a subclass of Ptr. It represents the idea of a hard constant. A hard constant is not just semantically a constant, but is something that MUST remain constant for system stability. Any attempt to assign to a Critical raises an Error. Very useful to maintain keywords and for other stability needs.

Throw

A typed cell for error processing. This type represents a produced error, and propagates an error context through the program. It is a subclass of Blank. This may seem odd, considering it's a data error, but it is placed on the code stack, and controls program flow. The Catch class can catch errors.

False

This is a subclass of Blank with the property of having a false value, instead of a true value. It also does not duplicate to a different object. In this way boolean algebra can be represented, and also the difference between many anythings and the same anything can be represented. Things which are true are not always the same, where as all things false are the same thing. Everything except False is true and maybe different.

Func

An executable list embedding typed cell. This is a subclass Blank, but represents a subroutine call, or something that has execution potential. The default behaviour is to nest and stack as threaded code.

Lit

A literal number or character code typed cell. There is no difference between integer and character information types, and strings are represented by a chain of literal integer types. It is a subclass of Blank, for easy presentation of literals to the stack, and to remove possible binary instability by the idea of data as an execution vector becoming impossible. Literals are thus truly literal.

Prim

A primitive typed cell containing an instruction. It represents an underlaying machine code instruction of the ScriptLanguage VirtualMachine. It is a subclass of Critical. The bootstrap Virtual Prim instruction is default.

Ptr

A pointer data reference typed cell. This type is essential to have references to values, such that variables may be created simply. It also allows pointer passing, and security against dereference when used with read and write. For a simplified security model and type safety reasons, pointer arithmetic is not allowed. It is a subclass of Func.

Real

A complex floating point typed cell. The double size float is used. There is not much use in the single size float, except for smaller and faster speed of execution, but precision is preferred before speed, and one type is preferred for simplicity. It is a subclass of Lit. This may fluster some novice programmers, but a good grounding in complex numbers should come early. It is still called Real, even though it is a complex number.

Stack

This class is a subclass of Ptr. It represents a stack pointer and allows evaluation and writing to a stack instead of a singular variable, using the regular SL mechanism of evaluate and assign.

Strong

This class is a subclass of Ptr. It represents a strong reference. When the reference is made to reference something, the class of the old reference is checked to see if the assignment class matches before the assignment is allowed to happen. This provides type security on essential system variables.

Unfound

A pointer which has no found reference, which is a subclass of Ptr. This is useful for one pass parse forward definitions, and possible improvements in local scoping. It will resolve to another Ptr type on evaluation or assignment, or produce an Error. A cache means this evaluation is performed only once.

Virtual

This class is a subclass of Vocab, allowing easy operating keywords. It is the parent class of all the Classes not on this page, so that system objects can be represented in ScriptLanguage, and have operations performed on them. All objects of the same type share the same set of base words. This way of object orienting Virtual objects, is preferred before sub-classing Prim.

Vocab

This class is a subclass of Ptr. Its purpose is to support some kind of symbol organization in to an ordered vocabulary or book in ScriptLanguage.

Powered by Google Project Hosting