Commit Graph

61 Commits

Author SHA1 Message Date
Thakee Nathees
b285336895 fiber stored as register variable
and the benchmark script refactored, and now it will generate an
html report
2022-04-14 08:01:16 +05:30
Thakee Nathees
8d062e38b8 closures were completely added. 2022-04-13 14:31:57 +05:30
Thakee Nathees
227be9aab5 local variable miss-calculation bug fix
for nested functions the count of locals and the required stack size
are miss-calculated, ie. No new count wasn't started for inner functions
it makes the required stack size greater than or equal to it's enclosing
functions stack size.
2022-04-12 16:29:20 +05:30
Thakee Nathees
8c039b5d77 fn, cls moved to constants buffer
functions and classes are moved to constant buffer, and forward
names are resolved for globals.
2022-04-11 00:02:21 +05:30
Thakee Nathees
9b7ad74a7c pk_var changed to pk_value and some minor changes 2022-04-07 06:13:29 +05:30
Thakee Nathees
2bc09f41e5 Stack miss calculation bug fix & minor changes 2022-04-06 08:56:51 +05:30
Thakee Nathees
967cf3a0ed name interpolation implemented
The below is a valid syntax:
  name = "World"
  print("Hello $name!")
2022-04-05 10:22:23 +05:30
Thakee Nathees
0d87403f6b string interpolation implemented (1/2)
expression interpolation have implemented (ie. "a${b}c")
name interpolation yet to do (ie. "a $b c")
2022-04-05 08:27:46 +05:30
Thakee Nathees
c3544fb92b A test suite added to test random things. 2022-04-05 02:59:05 +05:30
Thakee Nathees
402f36f7e5
docs were fully refactored (#175) 2022-04-04 08:47:15 +05:30
Thakee Nathees
cda9cc75ca
un used functions were removed (#174)
In addition tail call is not enabled for functions that
doesn't return the last call (caused a bug).
2022-04-03 21:03:12 +05:30
Tim Gates
bcfa4de706
docs: Fix a few typos (#167)
There are small typos in:
- README.md
- cli/modules.c
- src/pk_compiler.c
- src/pk_core.c
- src/pk_opcodes.h
- src/pk_vm.h
- tests/benchmarks/benchmarks.py

Fixes:
- Should read `temporary` rather than `temproary`.
- Should read `stdout` rather than `stdour`.
- Should read `sprintf` rather than `spritnf`.
- Should read `splitted` rather than `splited`.
- Should read `script` rather than `scirpt`.
- Should read `reported` rather than `repored`.
- Should read `reduce` rather than `recude`.
- Should read `performance` rather than `preformance`.
- Should read `instead` rather than `insted`.
- Should read `default` rather than `defalt`.
2022-03-30 23:20:44 +05:30
Victor Akpan
9635c223b1
Added new Math functions (#160)
* Added log and round functions to math module

* Added log and round functions to math module

* Added a few math functions

* Static checks

* Maybe this will fix linux

* Fixed errors with styles and tests
2022-03-30 23:14:01 +05:30
Thakee Nathees
89f8b77bb6
imported scripts were initialized (#158) 2021-07-02 21:32:30 +05:30
Thakee Nathees
3ef213b170 native api refactored (#157) 2021-07-01 14:55:53 +05:30
Thakee Nathees
6ad5dfe9f7
native api function improvements (#153) 2021-06-30 12:09:17 +05:30
Derick Alangi
f1bbafaa28
Introduce support for substring function - str_sub() (#152)
This function takes in 3 arguments: the string, the position and the
length (of the substring). As a quick example, a call to the function

`str_sub('c programming', 3, 11)`

will return the string 'programming' as the substring to the string
that is provisioned to the function call.
2021-06-29 18:18:41 +05:30
Thakee Nathees
273a31e588 native types initialization & attribute getters. (#147)
getters/setters native api functions added to the
vm's configurations and native types were initialized.
2021-06-29 00:30:41 +05:30
Derick Alangi
e74e209b7c
Add support for hyperbolic & arc trigonometric functions (#126)
Functions added are: `sinh(x)`, `cosh(x)`, `tanh(x)`, `asin(x)`,
`acos(x)`, and `atan(x)`.

In addition, basic tests added in core.pk for these functions.
2021-06-26 18:13:29 +05:30
Thakee Nathees
a6b20787f8 benchmarks - files validated and ordered 2021-06-24 17:33:17 +05:30
Luke Edwards
6ce5c9f57e
fix(bench): do not double-reverse in list.js file (#133) 2021-06-24 11:43:17 +05:30
Luke Edwards
aba0546c2a
chore(bench): add lua benchmarks (#135) 2021-06-24 11:42:32 +05:30
Thakee Nathees
beaff939bb benchmarks script refactored (#134) 2021-06-24 11:16:51 +05:30
Luke Edwards
07321cc660
chore: include nodejs benchmarks (#125)
* chore: include nodejs benchmarks;

- Related #124

* chore: fix `factors.js` typo
2021-06-23 23:17:08 +05:30
Jordan Ellis Coppard
39c5fba9d9
add elem in map (#121) 2021-06-23 21:03:26 +05:30
Tiago Cavalcante Trindade
6d434db0cb
Add <<= and >>= operators (#119)
* Add <<= and >>=
2021-06-23 19:54:20 +05:30
Thakee Nathees
64bf27674a
in test (ie. elem in container) implemented. (#117)
in keyword will invoke varContains(), the for now the list contains
implemented.
2021-06-23 15:51:59 +05:30
Thakee Nathees
000f4c4fe4
yet another docs update (#115) 2021-06-23 10:51:18 +05:30
Dmitry Guzeev
dbdb43b8ed
Number literal parsing (#106)
* Implement proper number literal parsing

- Scientific notation support
- Correct error handling in cases of invalid digits present in binary or
  hex literals (0b123, 0x013FK).

* Fix style linter issues

* Support +/- in number literal exponent, add tests

- Add tests for scientific notation number literal parsing
- Add support for +/- in scientific notation exponents
2021-06-23 10:30:06 +05:30
Derick Alangi
28cdd564d3
Fix minor typos in test files (#114) 2021-06-23 09:51:58 +05:30
Tiago Cavalcante Trindade
792d08eae7
Move fiber functions to module Fiber (#113) 2021-06-23 09:48:15 +05:30
Tiago Cavalcante Trindade
fe45ba3485
Numeric literal starts with decimal point implementation (Fix: #97) 2021-06-23 00:51:19 +05:30
Takashi Idobe
c0f00f6cae
add modeq implementation (#108)
* add modeq implementation

* code review feedback
2021-06-22 17:49:52 +05:30
Thakee Nathees
600f972927 Native types & File object implementations. 2021-06-22 13:31:21 +05:30
Thakee Nathees
41ed7dd991 class implemented 2021-06-21 12:13:37 +05:30
Thakee Nathees
4ba3ee2e28 __file__ added and some todos were completed 2021-06-20 09:29:26 +05:30
Thakee Nathees
733f006b03
Merge pull request #95 from ThakeeNathees/pk_doc
[WIP] Docstring extracted and `help()` function added
2021-06-18 15:45:19 +05:30
Thakee Nathees
e1628f1a73 docstring for pocket functions implemented 2021-06-18 14:52:24 +05:30
Derick Alangi
fbcf6fc1a1 use PEEK() so we don't loose reference 2021-06-17 13:43:09 +01:00
Derick Alangi
ac1d825f13 Add support for bitwise NOT (~) operator to pocketlang
Like other bitwise operators like: &, ^, >>, << etc, add support
for the bitwise NOT (~) operator.
2021-06-17 13:40:56 +01:00
Thakee Nathees
f3fa3a61d3 scons script removed and build scripts refactored 2021-06-17 16:13:47 +05:30
Thakee Nathees
d8f1ee8fe3
Merge pull request #75 from ekinbarut/master
Changed the elif notation to else if
2021-06-16 14:04:34 +05:30
Ekin
22669bc226 changed the keyword in unit tests, prism and in the md 2021-06-16 11:14:35 +03:00
Thakee Nathees
1d8cd13d4e
Merge pull request #81 from alexcpatel/tests-from-anywhere
tests: allow tests to be called from anywhere
2021-06-16 10:40:42 +05:30
Alexander Patel
d830a59c7c tests: allow tests to be called from anywhere
Currently, it is required for the shell's working directory to be in
the repo's test/ directory in order for the tests to run correctly.
This also applies for the static analysis checker.

The reason for this is that paths in the test orchestration code are
defined relative to the test directory. Instead, and since none of
these scripts are modules that will in the forseeable future be
imported into other files, we update all paths to be relative
to the absolute path of the script's file itself.

┏( ͡❛ ͜ʖ ͡❛)┛
2021-06-15 21:41:36 -07:00
Alexander Patel
59333177cd pk_core: implement list addition
This commit implements list addition. A new list is allocated, and
the contents of l1 and l2 are concatenated onto the list.

This is done by extending the buffer template macro to support a
`concat` operation, which given an `other` buffer, appends all
elements of the `other` buffer to the end of the `self` buffer.
Allocations are done as needed.

We implement this additional operation, since the alternative would
be to call `reserve()` for each `write()` operation, which doesn't
seem ideal.

Issue: #55
2021-06-15 20:44:10 -07:00
Thakee Nathees
5f6f66517f Merge pull request #77 from ThakeeNathees/ci-workflow2
ci workflow script (build.yml) created [2/2]
2021-06-16 05:19:19 +05:30
Thakee Nathees
945af460e0 CI-workflow implemented 2021-06-16 02:57:01 +05:30
Thakee Nathees
7ab4e55d6e
bin hex literals implemented (#72) 2021-06-16 00:24:30 +05:30
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