This commit addresses issue #54 in an attempt to add more bitwise
operators to pocketlang. Tests have also been written to verify that
the operators indeed works as expected.
To add, I also introduced a macro PK_RIGHT_OP that just aliases the
string "Right operand" which was already getting too hardcoded and
appearing too much in the pk_core.c file.
* Fix#54: Add bitwise OR operator and make it available in PKVM
Like the bitwise AND, this is an implementation for pocketlang to
support the bitwise OR operation. In addition, updated "value" ->
"result" in other operation to correctly reflect the container's
purpose. It's indeed the result after the operation, which is a value
too.
In addition, add tests for bitwise AND (&) and bitwise OR (|). Add a
print statement in test file with message that all tests passed with
no errors.
* Fix typo in comment
* Cleanup fixes
I've also written tests in the corresponding test files, please have
a look. But on the command line (after compiling the source), do:
>>> from math import *
>>> print(cos(1))
[ results will be displayed here ]
>>> print(tan(1))
[ results will be displayed here ]
* While reading various files in the repo, just going ahead to
clean up some typos (for clarity of text).
* When calling `realloc()`, let the pointer be returned to the
first byte of the memory block after resize. Compiler warns against
not doing this too.
* In addition, rename the file uitls.c to "utils.c" which seems to
be the correct name in this case.
NOTE: I recompiled and tested the `./pocket` intepreter and it still
works as expected.
* A quick documentation on how to run a pocketlang program locally
With a small factorial program written in pocketlang and executed
on the terminal, this demonstrates how to execute a script on a
loalhost using pocketlang binary
* Apply changes requested in review #1
- popping operands from the stack was too early -fixed
- some temproary string objects weren't pushed to the vm's temp root
-fixed
- and some minor bug fixed