Commit Graph

273 Commits

Author SHA1 Message Date
Thakee Nathees
6992f54ef3 Tail call optimization implemented 2021-06-13 21:57:54 +05:30
Derick Alangi
22be6af376 Add support for bitwise XOR, LSHIFT and RSHIFT operators (#63)
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.
2021-06-13 20:27:48 +05:30
Thakee Nathees
9b2d28ef45 docs update after lang.disas 2021-06-13 11:03:18 +05:30
Derick Alangi
2707c1eec3
Fix #54: Add bitwise OR operator and make it available in PKVM (#59)
* 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
2021-06-13 09:43:05 +05:30
Thakee Nathees
04bc61e93d
Merge pull request #61 from ThakeeNathees/disas
Disassembler public api for debugging.
2021-06-12 16:40:56 +05:30
Thakee Nathees
17df5eb1e4 disassemble implemented 2021-06-12 16:34:10 +05:30
Thakee Nathees
473daa4716
Merge pull request #58 from xSavitar/cos-and-tan
Fix #56: Implement the `cos()` and `tan()` math functions
2021-06-11 23:00:02 +05:30
Derick Alangi
15716de9ce Fix #56: Implement the cos() and tan() math functions
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 ]
2021-06-11 18:14:20 +01:00
Thakee Nathees
749456e215 some (minor) code cleanups 2021-06-11 13:16:55 +05:30
Thakee Nathees
4bf045bcac
Merge pull request #52 from ThakeeNathees/authors-file-created
created an AUTHORS file.
2021-06-11 01:15:14 +05:30
Thakee Nathees
4d2fc474f9 created an AUTHORS file. 2021-06-11 01:14:14 +05:30
Thakee Nathees
484aa5d88f
Merge pull request #51 from ThakeeNathees/core-attrib
Core attributes refactored and added tests
2021-06-10 23:55:05 +05:30
Thakee Nathees
9fdab23a94 core attributes refactored and added tests 2021-06-10 23:12:04 +05:30
Derick Alangi
3a7ffc7cf1
Cleanup more typos from cli/ source files (#50) 2021-06-10 07:53:16 +05:30
Derick Alangi
fd6d2412ee
Fix more typos in cli/common.h (#49) 2021-06-10 04:27:28 +05:30
Derick Alangi
04c333a15e
Set pointer to first byte of mem block when realloc()'d (#48)
* 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.
2021-06-10 04:10:24 +05:30
Thakee Nathees
49c1fec85f
REPL implementation. (#47) 2021-06-09 16:12:26 +05:30
Derick Alangi
1a60646e38
Fix minor typos, while reading codebase (#46)
* Fix minor typos, while reading codebase

* Fix typo in common.h comment

* Fix typo in src/common.h
2021-06-08 22:19:58 +05:30
Derick Alangi
595f120ecd
A quick documentation on how to run a pocketlang program locally (#45)
* 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
2021-06-08 21:51:15 +05:30
Thakee Nathees
63d3039eeb
Merge pull request #44 from ThakeeNathees/repl-refactor-3
REPL refactor [3/3]
2021-06-08 20:22:39 +05:30
Thakee Nathees
9901d4d441 REPL refactor [3/3] 2021-06-08 19:32:43 +05:30
Thakee Nathees
14ff7070bb
Merge pull request #43 from ThakeeNathees/repl-refactor-2
Refactor for REPL support [2/3]
2021-06-07 20:13:21 +05:30
Thakee Nathees
fdf685731d refactor for repl support [2/3] 2021-06-07 20:00:35 +05:30
Thakee Nathees
3092118008 Merge pull request #42 from ThakeeNathees/fiber-docs
fiber documentations
2021-06-07 07:20:06 +05:30
Thakee Nathees
3558a1994a fiber documentation written 2021-06-06 19:48:47 +05:30
Thakee Nathees
8800c1baf0 Merge pull request #41 from ThakeeNathees/fiber-vm
Fiber implemented.
2021-06-06 07:46:43 +05:30
Thakee Nathees
e1711b1c9d fiber implemented. 2021-06-06 03:10:58 +05:30
Thakee Nathees
8d869cec26
Merge pull request #40 from ThakeeNathees/repl
VM refactor for REPL [1/3]
2021-06-05 18:53:46 +05:30
Thakee Nathees
284232c8c6 minor parser refactor for repl 2021-06-05 18:50:53 +05:30
Thakee Nathees
d74a06eacf Merge pull request #39 from ThakeeNathees/style-guide
some style guides were enforced.
2021-06-04 13:46:52 +05:30
Thakee Nathees
0bebeaafdf some style guides were enforcde.
- according to https://github.com/mcinglis/c-style
2021-06-04 13:26:50 +05:30
Thakee Nathees
6ee8226a50 Merge pull request #38 from ThakeeNathees/more-docs
more comments written through out the source
2021-06-03 07:47:19 +05:30
Thakee Nathees
f9bf0c1b9c more comments written throught out the source 2021-06-03 07:40:07 +05:30
Thakee Nathees
2c1468f0e8 Merge pull request #37 from ThakeeNathees/bug-fixes
controlflow bugs fixed
2021-06-02 19:53:04 +05:30
Thakee Nathees
db0f4ebb5e controlflow bugs fixed 2021-06-02 17:32:13 +05:30
Thakee Nathees
c9c0c56dbc Merge pull request #36 from ThakeeNathees/docs-improve
documentations updated
2021-06-02 09:24:28 +05:30
Thakee Nathees
3b36e9002e documentations updated 2021-06-02 09:13:56 +05:30
Thakee Nathees
39c3bb41a0
Merge pull request #35 from ThakeeNathees/readme-update
readme updated with performance benchmarks
2021-05-31 05:33:35 +05:30
Thakee Nathees
ff0babb8a7 readme updated with preformance benchmarks 2021-05-31 05:31:41 +05:30
Thakee Nathees
55fbfe18bc
Merge pull request #34 from ThakeeNathees/path-lib
Path library implemented
2021-05-30 05:50:32 +05:30
Thakee Nathees
0e450bc7b1 path library implemented 2021-05-30 05:46:04 +05:30
Thakee Nathees
c035abf0dd
Merge pull request #33 from ThakeeNathees/build-docs
build docs implemented
2021-05-28 18:06:46 +05:30
Thakee Nathees
45bcfc437c build docs implemented 2021-05-28 17:56:21 +05:30
Thakee Nathees
897a08b3cf
Merge pull request #32 from ThakeeNathees/test-optimizations
Iterations were heavily optimized
2021-05-27 22:53:30 +05:30
Thakee Nathees
185a71914a Iterations were heavily optimized 2021-05-27 15:38:33 +05:30
Thakee Nathees
b68db7d5fb
Merge pull request #31 from ThakeeNathees/more-builtin-fn
gc bugs fixed
2021-05-23 23:29:37 +05:30
Thakee Nathees
df93b2c1ec gc bugs fixed
- 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
2021-05-23 23:25:04 +05:30
Thakee Nathees
79a3700284
Merge pull request #30 from ThakeeNathees/custom-libs
Native function api implemented
2021-05-23 02:35:50 +05:30
Thakee Nathees
8738ccfe64 Native function api implemented 2021-05-23 02:29:32 +05:30
Thakee Nathees
82982d3ceb
Merge pull request #29 from ThakeeNathees/testing-impl
A small test script added
2021-05-22 18:59:28 +05:30