ViSlang is an intepreted language system for the development and analysis of visual computing programs. ViSlang consists of a runtime that acts as the unified programming interface to the user, several DSLs and an IDE. New DSLs that extend ViSlang are called slangs. The IDE includes a program editor and renderers that are able to visualize results of the computations.
Slangs encapsulate a certain functionality and register it with the ViSlang runtime. The ViSlang runtime implements an embedded interpreter that executes programs in an interactive environment. The user interacts with the integrated program editor to issue ViSlang commands.
The ViSlang language employs a dynamic type system (duck typing) to weakly enforce type compatibilities. When a value is assigned to a variable or when a function is called with a certain set of arguments, types are automatically downcasted if possible. Otherwise a run time error is generated. Variables and functions are typed and type compatibility is enforced during run-time. This guarantees the programmer that methods are only called with arguments of compatible types. Therefore, a method does not need to check types but can always assume that correct types are provided. The special type var can be used when run time inference of the actual type is desired. The integral types boolean, string, integer, and float are supported.
Vector data types:
The language supports a small set of instructions including variable declaration and assignment, function declaration and calls, conditionals, loops, as well as boolean and arithmetic expressions. Additionally, it supports syntactic constructs that are specialized to allow the seamless integration into existing user interfaces, and the combination of slangs in novel ways.
Links: The linking (and unlinking) instruction allows to couple (and if desired decouple) two variables. In addition to an assignment, the linking is persistent and updates one variable whenever the value of the other variable changes (and vice versa).
Triggers: A trigger is assigned to a variable to execute a function every time the value of the variable changes. This is useful to trigger execution of functions or update of slangs that depend on values of other variables. If a parameter of object A depends on the parameter of object B, a trigger is assigned to a function call that updates the parameter of object A and if necessary converts the parameters first.
An object typically encapsulates a set of variables and functions. Each object has its own name-space and can register variables and functions at compile- and run-time. A function call as well as the access to variables of an object are done with the typical "Object.Identifier" syntax.
For convenience the arrays object provides several methods for array manipulation.
The Images object provides several methods for image manipulation.
A slang additionally offers a programming interface to the user via the ViSlang language. A parser and execution interface are implemented that are called by the main language at run-time. The following example demonstrates the usage of slang that transforms code into an OpenCL kernels.
In ViSlang, each valid statement ends with either a block of code (enclosed by curly brackets) or with one of the terminal symbols ’:’ or ’;’. The semicolon symbol terminates the statement. The colon symbol triggers a call to all registered display functions with compatible signature. The type of the result of a statement is matched against all display functions. For instance the result of an assignment is the assigned value. If called with the colon symbol at the end of the statement the ViSlang system tries to display the result.
You can also use the display functionality to print an overview of all existing functions of an object.
Copyright © 2015-2020 vislang.net