Functions
dec_to_binary
def dec_to_binary(
n
)

Return binary from decimal number(n).

dec_to_two
def dec_to_two(
n
)

Return two's complement from decimal number(n).

binary_to_dec
def binary_to_dec(
n
)

Return decimal from two's complement number.

normalizelen
def normalizelen(
a,
b
)

Return (a,b) normalized.

is_greater
def is_greater(
a,
b
)

Return 1 if a > b, return 0 else.

binary_reverse
def binary_reverse(
a
)

Return reverse binary number.

binary_sum
def binary_sum(
a,
b
)

Return a+b.

binary_sub
def binary_sub(
a,
b
)

Return a-b.

binary_multiply
def binary_multiply(
a,
b
)

Return a*b.

binary_div
def binary_div(
a,
b
)

Return a/b if a >= b, return 0 else.

is_binary
def is_binary(
str
)

Return 1 if str is binary, return 0 else.

is_name
def is_name(
str
)

Return 1 if str is an operator, return 0 else.

peek
def peek(
stack
)

Return stack[-1] if stack is not empy else return None.

apply_operator
def apply_operator(
operators,
values
)

Function that append operation result in values stack.

greater_precedence
def greater_precedence(
op1,
op2
)

Function that return precedences operator.

evaluate
def evaluate(
expression
)

Evaluate expression and return result. (Implementation of shunting-yard algorithm)