Elog
Paradigm(s) | imperative |
---|---|
Designed by | Aptennap |
Appeared in | 2011 |
Memory system | stack |
Dimensions | one-dimensional |
Computational class | total |
Reference implementation | Java (Pastebin), C# (Pastebin) |
File extension(s) | unknown |
Elog is a stackbased language that can be used to model logical circuits.
Description
An Elog program takes a bitstring as input (for example "10101") and can output another bitstring. You can use a single character for a variable. The first variable that appears in the program gets bound to the first input bit, the second variable gets bound to the second input bit and so on.
Commands
The commands at the moment:
'
NOT gate&
AND gate|
OR gate^
XOR gate.
dup top stack item0
push 01
push 1:
pop bit and assign to next variable;
end program and print all variables (or 0 and 1) after;
Computational class
Since Elog has no way of performing loops, it is guaranteed to terminate. Otherwise, it is able to evaluate any combinational logic expression, as it is functionally complete.
Examples
The following program will take 4 input bits and will output 1 bit, 1 if the number is a prime else 0. Notice how at the end of the program the result bit is assigned to z (:z) and how z is the only variable after ;. Als notice how a, b, c and d are the first variables used, this will ensure that a, b, c and d will be bound to the right input bits.
ab'cd&&&ab'c&&bc'd&&a'cd&&|||:z;z
The following program will take 3 input bits and will multiply it by 2.
abc;abc0
This simulates a 2 bit multiplexer, notice how the 3 variables appear before the actual program, this to ensure the proper input bits are bound to the proper variables.
abs as'&bs&|:z;z