NerveScript is a simple metalanguage to describe a neural network in a compact, easily parsed form. NerveScript can be entered by hand in a text editor or generated by a visual programming interface. NerveScript is seven bit ASCII to allow behavioral designs to be sent by electronic mail.
NerveScript Language Components
Pathways
NerveScript directly describes pathways in a neural network. Those pathways are links which carry objects (referred to as tokens) from a source to a destination. Paths can have a delay component, a number represented in a generic clock cycle unit set up for each NerveScript. This delay will hold up tokens in the pathway for the set number of units. Pathways have a default delay of one unit.Tokens
Tokens can represent any datum, such as a message from an operating system, a database record, an event or interrupt. Entering data items are mapped upon entry into a NerveScript network (Nerve net) into a generic token name. The contents of the data item are carried along with the token as it travels through a Nerve net.Pools
Pools are collection points for tokens. Pools can have a defined or an unlimited capacity to contain tokens. Pools hold tokens in no particular order.Taps
Taps are tests applied to pools. A tap might be set up to test true if a token of a certain type is present in a pool. A tap can be set up to remove all tokens of a type from a pool or to make a copy of tokens. Taps can pass tokens on to another pool through a connected pathway or to a Function.Functions
A function is any object which can receive the tokens passed by a tap. Functional objects in VRML could be eventOuts, _changed ExposedFields. Tokens (or the data associated with them) could be passed on to other script or transform nodes.An Example of NerveScript
# A Nerve Node DEF testNode Nerve { field inStim eventIn set_inStim eventOut inStim_changed DEF token_red token { ... } DEF token_green token { ... } DEF token_blue token { ... } DEF test_for_red func { ... } DEF test_for_blue func { ... } # Our Nerve Bundle DEF tokenTester Bundle { -token_red,token_green,token_blue-POOL1-test_for_red-sendURL() POOL1=token_blue-test_for_blue-POOL2 POOL2-token_yellow-2- POOL1-trash } }
Explanation of the Example
In the above pseudocode example, incoming tokens are events affecting the exposedField inStim These events are mapped to tokens which travel along the path '-' into a pool called POOL1. Only the tokens named token_red,token_green,and token_blue are taken into the pool from the external environment.Once in POOL1, the tap test_for_red will remove all tokens it tests for and pass them to a function sendURL which may send the data associated with a token (perhaps a URL string) to a web browser (via WWWInline).
Next, messages remaining after test_for_red will be tested by the tap test_for_blue, which will pass a copy of all token_blue tokens into a new pool POOL2. The tap test_for_blue could have generated a new type of token into POOL2, called token_yellow, which is passed out (after a delay of two cycles) as a _changed setting for the exposedField.
All remaining tokens are drained from POOL1 without test into a pool called trash, which could be a token discarding function.
Some other salient features of NerveScript
- NerveScript is case sensitive.
- NerveScript is order dependent (taps will test for tokens in the order they are defined).
- Nerves is clocked and determinisitic: tokens move with certainty through the network in lock step.
- NerveScript is dimensionless (the pathways have no coordinates in space, so can cross at random).
- NerveScript is addressible: any pool in any nerve net can be addressed and a token placed or removed from that pool.
- Nerve objects are distributable: Nerve nodes would be able to send tokens to other Nerve nodes elsewhere in the network.