Global

Members

(constant) Complex

Contains some support functions to work with complex numbers.
Since:
  • Mar 04 2024
Author:
  • Juan Rodríguez Suárez
Source:

(constant) astTypes

Contains functions to analyze the scope of the program and the dependencies of the functions.
Since:
  • Mar 04 2024
Author:
  • Juan Rodríguez Suárez
Source:

(constant) calcParser

Contains all the code to transpile a mathematical expression to JavaScript.
Since:
  • Mar 04 2024
Author:
  • Juan Rodríguez Suárez
Source:

(constant) recast

Contains a function to generate the JavaScript code from the AST.
Since:
  • Mar 04 2024
Author:
  • Juan Rodríguez Suárez
Source:

Methods

$(id) → {string}

Parameters:
Name Type Description
id string The input
Source:
Returns:
The output
Type
string

buildAssignmentExpression(name, operator, right) → {object}

Parameters:
Name Type Description
name string The name
operator string The operator
right object The right node
Source:
Returns:
The assignment expression node
Type
object

buildCallExpression(functionName, args, reservedWord) → {object}

Parameters:
Name Type Default Description
functionName string The function name
args Array The arguments
reservedWord boolean false The reserved word
Source:
Returns:
The call expression node
Type
object

buildFunctionExpression(params, expression) → {object}

Parameters:
Name Type Description
params Array The parameters
expression object The return expression
Source:
Returns:
The function declaration node
Type
object

buildIdCalls(id, calls) → {object}

Parameters:
Name Type Description
id string The identifier
calls Array The calls
Source:
Returns:
The sequence of calls
Type
object

buildIdentifier(name) → {object}

Parameters:
Name Type Description
name string The name
Source:
Returns:
The identifier node
Type
object

buildLiteral(value) → {object}

Parameters:
Name Type Description
value string The value
Source:
Returns:
The literal node
Type
object

buildLogicalExpression(left, operator, right) → {object}

Parameters:
Name Type Description
left object The left node
operator string The operator
right object The right node
Source:
Returns:
The logical expression node
Type
object

buildMemberExpression(object, operator, args) → {object}

Parameters:
Name Type Description
object object The object
operator string The operator
args Array The arguments
Source:
Returns:
The member expression node
Type
object

buildRoot(child) → {object}

Parameters:
Name Type Description
child object The child node
Source:
Returns:
The root node
Type
object

buildSequenceExpression(expressions) → {object}

Parameters:
Name Type Description
expressions Array The expressions
Source:
Returns:
The sequence expression node
Type
object

buildUnaryExpression(operator, argument, prefix) → {object}

Parameters:
Name Type Description
operator string The operator
argument object The argument
prefix boolean The prefix
Source:
Returns:
The unary expression node
Type
object

buildVariableDeclaration(declarations) → {object}

Parameters:
Name Type Description
declarations Array The declarations
Source:
Returns:
The variable declaration node
Type
object

buildVariableDeclarator(id) → {object}

Parameters:
Name Type Description
id object The id
Source:
Returns:
The variable declarator node
Type
object

(async) codeGen(ast) → {string}

Parameters:
Name Type Description
ast object The AST
Source:
Returns:
The JavaScript code
Type
string

dependencies(dAst) → {object}

Parameters:
Name Type Description
dAst object The decorated AST
Source:
Returns:
The decorated AST
Type
object

difference(setA, setB) → {Set}

Parameters:
Name Type Description
setA Set The first set
setB Set The second set
Source:
Returns:
The difference
Type
Set

max(a, b) → {Complex}

Parameters:
Name Type Description
a Complex The first number
b Complex The second number
Source:
Returns:
The maximum
Type
Complex

min(a, b) → {Complex}

Parameters:
Name Type Description
a Complex The first number
b Complex The second number
Source:
Returns:
The minimum
Type
Complex

print(x) → {Complex}

Parameters:
Name Type Description
x Complex The input
Source:
Returns:
The input
Type
Complex

scopeAnalysis(dAst) → {object}

Parameters:
Name Type Description
dAst object The decorated AST
Source:
Returns:
The decorated AST
Type
object

(async) transpile(expression, inputFile, jsFile, astFile)

Parameters:
Name Type Description
expression string The input
inputFile string The input file
jsFile string The output JavaScript file
astFile string The output AST file
Source: