Commit Graph

136 Commits

Author SHA1 Message Date
Ekin
8c51133cf1 Changed the else if notation to elsif, and the keyword count 2021-06-15 12:04:27 +03:00
Ekin
1f91d1ee81 changed the elif notation to else if 2021-06-15 11:27:19 +03:00
Alexander Patel
c58159b63d
Fix typos + rename variables (#73)
* fixed typos in src/

* fixed typos in docs/

* fixed typos in README and tests/

* rename INITALIZE to INITIALIZE

* rename PRIMITE to PRIMITIVE

* rename moudle to module

Co-authored-by: Alexander Patel <acpatel@andrew.cmu.edu>
2021-06-15 13:07:49 +05:30
Alexander Patel
ae4d2971c1 operator oreq and xoreq implemented 2021-06-14 21:36:10 -07:00
Thakee Nathees
72e7522c12 operator andeq implemented 2021-06-14 21:50:07 +05:30
Thakee Nathees
1ea9e4c5c7
Merge pull request #67 from ThakeeNathees/import-name-bug
import name bind bug fix
2021-06-14 10:16:17 +05:30
Thakee Nathees
558241a77b import name bind bug fix
stack curreption (due to stack missing parameters)
fixed, and some assertion macros added.
2021-06-14 09:55:18 +05:30
Derick Alangi
f1ac31953a Cleanup some typos from the include/pocketlang.h header file 2021-06-13 19:22:57 +01:00
Thakee Nathees
e90763c878 Merge pull request #65 from xSavitar/attr-range-start-end
Add support for `.start` and `.end` attributes on Range objects
2021-06-13 22:30:16 +05:30
Derick Alangi
ece87384ab Add support for .start and .end attributes on Range objects
This is an attempt to implement `.start` and `.end` on range objects
to fix issue #60.
2021-06-13 17:30:22 +01:00
Thakee Nathees
d7f7c21081
Merge pull request #62 from ThakeeNathees/tco
Tail call optimization implemented
2021-06-13 21:58:36 +05:30
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
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
17df5eb1e4 disassemble implemented 2021-06-12 16:34:10 +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
9fdab23a94 core attributes refactored and added tests 2021-06-10 23:12:04 +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
Thakee Nathees
9901d4d441 REPL refactor [3/3] 2021-06-08 19:32:43 +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
284232c8c6 minor parser refactor for repl 2021-06-05 18:50:53 +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
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
3b36e9002e documentations updated 2021-06-02 09:13:56 +05:30
Thakee Nathees
ff0babb8a7 readme updated with preformance benchmarks 2021-05-31 05:31:41 +05:30
Thakee Nathees
0e450bc7b1 path library implemented 2021-05-30 05:46:04 +05:30
Thakee Nathees
45bcfc437c build docs implemented 2021-05-28 17:56:21 +05:30
Thakee Nathees
185a71914a Iterations were heavily optimized 2021-05-27 15:38:33 +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
8738ccfe64 Native function api implemented 2021-05-23 02:29:32 +05:30
Thakee Nathees
deda294326 a small test script added 2021-05-22 18:57:40 +05:30
Thakee Nathees
994baea600 function name resolve implemented 2021-05-20 19:35:57 +05:30
Thakee Nathees
53ac9a6ae8 yet another import statement refactor 2021-05-19 18:56:36 +05:30
Thakee Nathees
41667eb218 relative import initial commit
parser and compiler are combined to just parser struct
2021-05-18 22:07:05 +05:30
Thakee Nathees
bd41435519 Merge pull request #22 from ThakeeNathees/chain-call-test
chain call implemented
2021-05-17 13:39:21 +05:30
Thakee Nathees
c2f67d0b48 chain call implemented 2021-05-16 14:46:58 +05:30
Thakee Nathees
0d6f2ce6a3 and or expression parsing implemented 2021-05-15 23:27:34 +05:30
Thakee Nathees
73fc379560 gc sweep/ stack reallocation implemented 2021-05-15 20:51:27 +05:30
Thakee Nathees
0c22a4d8e8 builtin function refactored.
- try now page won't crash anymore for core initialization.
2021-05-15 14:59:44 +05:30
Thakee Nathees
c3041c74a9 fixed: iterator (internal) variables popped twise.
printing stack trace implemented
2021-05-15 00:31:31 +05:30
Thakee Nathees
5c1b776047 fixed: local variables wasn't poped from the scope 2021-05-13 14:40:57 +05:30
Thakee Nathees
89a1cd1c4f try-online wasm implementations 2021-05-12 18:54:56 +05:30
Thakee Nathees
1d2d88fa7a docs source moved to master
generated files only remain in docs/ branch
2021-05-12 13:42:54 +05:30
Thakee Nathees
3e444ad196 assertion function and tests impl.
- main moved to cli
2021-05-11 18:05:09 +05:30
Thakee Nathees
57931c5dca python like import statement implemented 2021-05-10 00:30:59 +05:30
Thakee Nathees
dd42fc61ad import statement refactored 2021-05-09 18:01:36 +05:30
Thakee Nathees
68c73ccaf4 method symbol names refactored 2021-05-09 15:58:00 +05:30
Thakee Nathees
4a45135399 build script refactored to single file 2021-05-09 12:08:12 +05:30
Thakee Nathees
7ea8df652c language name changed to pocketlang 2021-05-08 16:24:07 +05:30
Thakee Nathees
58849ab1c3 null path bug (from last commit) fixed 2021-05-07 16:04:15 +05:30
Thakee Nathees
3e5f9553cb import system backend refactored 2021-05-07 12:51:34 +05:30
Thakee Nathees
e613203cca import statement refactor 2021-05-06 19:49:30 +05:30
Thakee Nathees
0db6cf9780 Merge pull request #9 from ThakeeNathees/map-literal
map literal and subscription operation implemented
2021-05-06 14:20:56 +05:30
Thakee Nathees
414bb43012 map literal and subscription operation implemented 2021-05-06 10:30:02 +05:30
Thakee Nathees
a33750f26f script name buffer refactored
- name table removed completely
2021-05-05 11:48:22 +05:30
Thakee Nathees
6e5d2e06b5 initial buffer refactor commit 2021-05-05 10:25:27 +05:30
Thakee Nathees
46a3b68932
Merge pull request #7 from ThakeeNathees/map-implementation
open addressing and linear probing map implementation.
2021-05-04 15:55:31 +05:30
Thakee Nathees
e382a0430c map methods implemented 2021-05-04 15:54:26 +05:30
Thakee Nathees
f61c7bfa68 value hash implemented 2021-05-03 18:39:23 +05:30
Thakee Nathees
d901b7fc7e reachability analysis implemented 2021-05-01 15:43:39 +05:30
Thakee Nathees
8a438b4f7e string format method implemented 2021-04-28 19:26:56 +05:30
Thakee Nathees
bd4642be70 early root marking implemented 2021-04-27 11:19:38 +05:30
Thakee Nathees
34716b4f6b garbage collection implementations. 2021-04-25 20:49:39 +05:30
Thakee Nathees
f7c3b2b8e2 fiber implemented and calling convention fixed. 2021-02-25 14:33:06 +05:30
Thakee Nathees
e6bcc7abe9 list close bracked line consume bug fix 2021-02-23 02:11:05 +05:30
Thakee Nathees
869d87256c debug information for compiled opcodes implemented 2021-02-17 23:57:24 +05:30
Thakee Nathees
d7495235aa a list of TODOs created 2021-02-16 23:58:03 +05:30
Thakee Nathees
6c88b99065 elif jump implemented 2021-02-16 11:46:47 +05:30
Thakee Nathees
f090089e4b increment operators implemented 2021-02-15 18:19:19 +05:30
Thakee Nathees
39a3172d69 function literal implemented 2021-02-13 22:54:00 +05:30
Thakee Nathees
38a22fea9f iterator implemented 2021-02-12 23:14:07 +05:30
Thakee Nathees
2b132409e2 import statement refactored to a builtin function 2021-02-12 12:39:33 +05:30
Thakee Nathees
21c57a6d39 vm implementations 2021-02-11 23:05:43 +05:30
Thakee Nathees
fb61ab147b vm implementations 2021-02-10 22:53:48 +05:30
Thakee Nathees
09d397bbfc opcodes implemented 2021-02-09 13:51:10 +05:30
Thakee Nathees
6317274d89 vm configuration implemented 2021-02-08 00:00:29 +05:30
Thakee Nathees
c77801daf3 initial commit 2021-02-07 13:17:58 +05:30