Skip to content

Nan Adapter Primitives

Leon Matthes edited this page Jan 16, 2019 · 4 revisions

Primitives

The available primitives can be read with a call to:

require('InterpreterNan').primitives();

Example output:

[ { ID: 0,
    inputs: [ 'Double', 'Double' ],
    outputs: [ 'Double' ],
    name: '+',
    callType: 'Function' },
  { ID: 1,
    inputs: [ 'Double', 'Double' ],
    outputs: [ 'Double' ],
    name: '-',
    callType: 'Function' },
  { ID: 2,
    inputs: [ 'Double', 'Double' ],
    outputs: [ 'Double' ],
    name: '*',
    callType: 'Function' },
  { ID: 3,
    inputs: [ 'Double', 'Double' ],
    outputs: [ 'Double' ],
    name: '/',
    callType: 'Expression' } ]

The output is an array of primitive declarations Each primitive declaration has the following attributes:

  • ID: the ID of the primitive (see Function blocks)
  • inputs: an Array of datatype names
  • outputs: an Array of datatype names
  • name: a string containing the name of the function
  • callType: String, either "Function" or "ExpressionStatement"