Home » Perso. » Nodable

Nodable

This software is a node-able bidirectionnal expression editor.

C++ / OpenGL / SDL2 / ImGui

Software architecture

The software is built to be dynamically reflective. The base class Object has members called Member. They can be added, modified (data and type) or removed at runtime. A Member wraps a Variant class that can handle basic data types such as Booleans (bool), Numbers (double) or Strings (std::string).

Two Members can be linked by a Wire. A Wire is an oriented edge, so it has a source and a target Value.

The Object derived class Entity is able to attach Component on it. Component is the base class for all components. For now there are only few components :

  • View : to draw the entity on screen (derived: NodeView, WireView, ApplicationView…)
  • Operation : to perform a computation (derived: BinaryOperation, BinaryOperationAdd, …Substract, …Multiply, … Divide)
  • Container : to contain other entities.
  • DataAccess: to load/save and entity to a JSON file.

Variable class is an Entity with a single Member named « value ».

Lexer class is an Entity able to convert an expression to a graph.

Application is a class to rule them all !

This diagram may not reflect the current state of the software because it is evolving continiously.
I update the diagram less frequently.

Source code

If you’re interested by the code source, you can download it from github.com

The language :

Introduction:

For now the syntax is really simple and works quite like a calculator.

User can edit expressions like:

10.5 + 5 * 10

90 * 10 + 5 / 12.04

Operands :

An operand could be :

  • a Boolean (ex: true, false)
  • a Number (ex: 1, 0.5, 100.456, etc.)
  • a String (ex: « Hello », « World », etc.)
  • a Symbol (ex: a, b, myVar, etc.)

Operand -> { Boolean , Number , String , Symbol }

Operators:

An operator could be only a binary operator :

  • an Addition
  • a Substraction
  • a Multiplication
  • a Division
  • an Assignment

Binary Operator -> { + , – , * , / , = }

All these binary operators supports precedence.

Expressions:

An expression could be :

  • a single Operand
  • a tuple formed by an Operand, a Binary Operator and an other Expression.

Expression -> { Operand , ( Operand , Binary Operator , Expression ) }

Unary operands are not allowed, so you can’t evaluate expressions like

Expression -> { ( Unary Operator, Expression ) } (ex: -10)

Platform compatibility :

Windows 7+ 32bits (64bits compatible)

History

Bibliography

Dependencies

Licence

Nodable is licensed under the GPL License, see LICENSE for more information.

Each submodule is licensed, browse /extern folder.

Laisser un commentaire