weblog

the parse interpreted algorithm language

This project concerns the production of the parse language and its interpreter.

20171102

The objective of this project is to create an unornamented algorithm language which has extensive applications in the processing of bitstring inputs. As an important disclaimer, this language is still very much in development, and it is becoming more sophisticated. The language is foreseen to eventually support recursive functions and conditionals, but currently, the language is relatively limited in function.

An algorithm expression will be made which specifies the operations to be evaluated using the bits from specified positions in the bitstring. The interpreter works with the input in segments of the number of characters of the number of variables specified in the expression.

For example, if the bitstring, 00011011, is evaluated with the expression, (0|1)&~(0&1), this will evaluate as follows, in which arrows express levels of evaluation:

(0|1)&~(0&1)->{0,1} (alternatively represented as (a|b)&~(a&b)->{a,b}) ->00,01,10,11 each evaluated with the expression ->(0|0)&~(0&0) ->0 ->(0|1)&~(0&1) ->1 ->(1|0)&~(1&0) ->1 ->(1|1)&~(1&1) ->0

This gives the output of 0110.

Expressions comprised of comma-delimited *phrases* allow for multiple operations to be performed on the same inputs, for example:

0|1,~(0&1)

This expression, when used to evaluate the same bitstring input used in the previous example, will evaluate as follows:

(0|1),~(0&1)->{0,1} (alternatively represented as (a|b),~(a&b)->{a,b}) ->00,01,10,11 each evaluated with the expression ->(0|0),~(0&0) ->0,1 ->(0|1),~(0&1) ->1,1 ->(1|0),~(1&0) ->1,1 ->(1|1),~(1&1) ->1,0

This gives the output of 01111110.

If this output were to be evaulated with the expression 0&1, the functional difference between the two preceding expressions, the bitstring would be evaluated as follows:

0&1->{0,1} (alternatively represented as a&b->{a,b}) ->01,11,11,10 each evaluated with the expression ->0&1 ->0 ->1&1 ->1 ->1&1 ->1 ->1&0 ->0

This gives the output of 0110, similarly to the first expression, because it takes the input in 2-groups and does an and operation on them, which is the functional difference between the previous two expressions.

This algorithm language can be used for many more applications than simply operating with 2-groups from the input bitstrings; operations can be performed using any number of variables less than or equal to the number of bits in the bitstring.

Only the bitring minus the remainder of it and the number of variables given in the expression will be evaluated, since only that part can possibly be evaluated using the given expression. For example, if a bitstring of an odd length is given in conjunction with an expression containing two variables, the remaining bit in the input will be ignored.