Skip to content

1. Expressions

Tom Chapman edited this page Dec 14, 2022 · 3 revisions

Operators

Currently, 8 operators are supported.

  • AND, &, .
  • OR, |, +
  • NOT, !, ¬
  • XOR
  • NAND
  • NOR
  • XNOR
  • IMPLIES, =>

Aliases can be used interchangeably in the same expression.

Brackets

Of course, you can use brackets to group expressions. Every type of bracket can be used, which may help distinguish groupings: () [] {}.

Variables

Any characters in an expression which aren't operators or brackets are considered variables. Variables can be any length, this allows for numbered variables (i.e., D_0).

To provide an order in which the variables should be printed, give a comma separated list of variables after your expression, separating these parts with a semicolon (;). If this isn't given, the variables are stored in the order they appear in the expression.

For example,

  • D0.!S + D1.S would be ordered D0, S, D1
  • D0.!S + D1.S;S,D0,D1 would be ordered S, D0, D1

Parsing

As the same parser class is used throughout every project, these rules apply in both the CLI and Web UI.

Example expressions

Here are a few example expressions.

  • A & B
    • A simple AND gate
  • A OR B
    • A simple OR gate
  • !S . D_0 + D_1 . S
    • A 2-1 multiplexer
  • (!S0 AND ¬S1 . D0) | (NOT{S0} . S1 . D1) + (S0 . {¬S1 & D2}) OR [S0 . S1 AND D3]
    • A 4-1 multiplexer, using several aliases for operators and brackets
Clone this wiki locally