Commit Graph

362 Commits

Author SHA1 Message Date
83c1693489 Fix cmake build with PK_DLL
Some checks failed
CI / style-check (push) Successful in 14s
CI / linux-build (push) Successful in 15s
CI / windows-build (push) Has been cancelled
CI / macos-build (push) Has been cancelled
2024-12-17 07:15:56 +00:00
8c8b87a8f4 Add CMakeLists.txt 2024-12-17 06:59:26 +00:00
Thakee Nathees
e316d53fa7 fiber ret updated before loading native modules 2022-06-14 17:22:32 +05:30
Thakee Nathees
f249d118b2 cwd added to search paths 2022-06-13 13:22:06 +05:30
Thakee Nathees
72a957daef
Merge pull request #252 from ThakeeNathees/class-static-attribute
static attribute to class added
2022-06-07 01:07:26 +05:30
Thakee Nathees
ca0fb6b54d static attribute to class added 2022-06-07 01:03:49 +05:30
Thakee Nathees
0e355ed6c4
Merge pull request #251 from ThakeeNathees/method-bind
method bind implemented
2022-06-06 21:00:33 +05:30
Thakee Nathees
5bc9dcad6b method bind implemented
- MethodBind type added.
- Now methods are first class and can be passed around as arguments
  store as a variable and return it from a function and they're first
  class callbales.
- Can bind instance to a method bind using .bind() method
- Class.methods() method added -> return a list of all methods as
  method binds
- Module.globals() method added -> returns a list of all globals
  of that module.
- Var._class -> attribute added which will return the class of the
  variable
- Class.name, MethodBind.name, Closure.name attribute and Modue._name
  attribute added
- Class._docs, Closure._docs, MethodBind._docs attribute added
- MethodBind.instance attribute added
2022-06-06 02:47:31 +05:30
Thakee Nathees
8e6f347009
Merge pull request #250 from ThakeeNathees/docstring
docstrings support added
2022-06-05 23:22:43 +05:30
Thakee Nathees
f908aa518d docstrings support added for native functions 2022-06-05 23:20:53 +05:30
Thakee Nathees
e6b094a926
Merge pull request #249 from ThakeeNathees/enhancements
minor enhancements/improvements
2022-06-05 12:56:31 +05:30
Thakee Nathees
2b940b227d minor enhancements/improvements
- json print implemented
- some bugs in io module fixed
2022-06-04 10:14:07 +05:30
Thakee Nathees
3b88205b1d
Merge pull request #248 from ThakeeNathees/hash-impl
Minor enhansments
2022-06-01 23:34:52 +05:30
Thakee Nathees
4f33aa7e25 types hash api implemented
and, or operators supports new line after the first
expression.
2022-06-01 18:31:51 +05:30
Thakee Nathees
c48cc7ea01
Merge pull request #247 from ThakeeNathees/json-impl
json library added
2022-06-01 02:12:17 +05:30
Thakee Nathees
d5b4b566e4 json library added
- cJSON library was added to thirdparty for json module
- json module added and json.parse() function implemented
- thirdparty library sources are directly imported
- io.readfile() function added
- less than function fix (wasn't returning boolean)
- min, max functions added
- map check values equal implemented
2022-06-01 01:49:39 +05:30
Thakee Nathees
52b2d1d8cb
Merge pull request #246 from ThakeeNathees/extension-module
Extension module implemented
2022-05-30 23:14:05 +05:30
Thakee Nathees
bd61e77593 extension module implemented
now it's possible to import a dynamic libray (*.dll, *.so) in
a pocket script.
2022-05-30 22:55:22 +05:30
Thakee Nathees
3136eb4817
Merge pull request #245 from ThakeeNathees/import-path
import system refactored
2022-05-30 17:34:55 +05:30
Thakee Nathees
1255db4bc8 import system refactored
- using normalized windows path in windows for import search.
- search path implemented, executable's path, exe/libs/ directories
  added to the search path.
- cwalk library updated after buf fix:08e7520d33
- dl library support added and will be implemented.
- generate_native.py refactored.
2022-05-30 15:48:24 +05:30
Thakee Nathees
b30dfc8e4f
Merge pull request #244 from ThakeeNathees/relpath-api-change
path library api changes
2022-05-29 19:02:33 +05:30
Thakee Nathees
191b2bb49b path library api changes
- relpath parameter order change for cosistency with python
- normalize change to normpath
2022-05-29 18:29:48 +05:30
Thakee Nathees
7ddd322ed6
Merge pull request #243 from ThakeeNathees/os-module
OS module implemented
2022-05-29 11:14:25 +05:30
Thakee Nathees
916424da5a OS module implemented 2022-05-28 22:17:55 +05:30
Thakee Nathees
176a0dc0c8
Merge pull request #242 from ThakeeNathees/moduel-string-source
Adding string source to module implemented
2022-05-28 17:00:19 +05:30
Thakee Nathees
bbafc914a0 adding string source to module added 2022-05-28 15:01:17 +05:30
Thakee Nathees
09879910ee Merge pull request #241 from ThakeeNathees/path-listdir
path.listdir, dir functions were added
2022-05-28 12:06:21 +05:30
Thakee Nathees
9ac483a5b0 path.listdir, dir functions were added 2022-05-28 01:13:08 +05:30
Thakee Nathees
6308f74f04 Merge pull request #240 from ThakeeNathees/term
term library added
2022-05-27 21:41:15 +05:30
Thakee Nathees
da6105d46c term library added 2022-05-27 18:59:52 +05:30
Thakee Nathees
052f1e263e
Merge pull request #239 from ThakeeNathees/invalid-assignment-bug
Invalid definition inside expression fixed
2022-05-27 17:50:04 +05:30
Thakee Nathees
aac9bb37f7 invalid definition inside expression fixed 2022-05-27 17:14:23 +05:30
Thakee Nathees
b020e249aa isVarType falsly returning VAR_NULL fix 2022-05-27 01:01:48 +05:30
Thakee Nathees
fb1e1099c7
Merge pull request #238 from ThakeeNathees/register-builtin
Register builtin function implementation
2022-05-26 11:20:22 +05:30
Thakee Nathees
9686b1fb75 Register builtin function implementation 2022-05-26 11:13:27 +05:30
Thakee Nathees
e458682486
Merge pull request #237 from ThakeeNathees/term
new Fiber objects falsely garbage collected -- fixed
2022-05-26 08:22:58 +05:30
Thakee Nathees
82919a690e Garbage collection bugs fixed
- Objects that weren't pushed to PKVM's temp reference were fixed
- vm->bytes_allocated was modified after the re-calculation of garbage
  collection fixed.
2022-05-25 16:44:58 +05:30
Thakee Nathees
0cfdfa7415 New fibers are not added to temp list -- fixed 2022-05-25 00:06:44 +05:30
Thakee Nathees
156a4e9203
Merge pull request #236 from ThakeeNathees/elif
else if change to elif
2022-05-24 15:43:47 +05:30
Thakee Nathees
6e91b66e69 else if change to elif again.
The primary purpose of this change is to disambiguate between
`else if` and `else \n if`.

Even though it's a breaking change, since it's at the very early
state we're allowed to make such breaking syntax change.

lang.write function moved to io and io.stdin, io.stdout, io.stderr
added for future streamed io operations

io.File read, write, open, close, getline, seek, tell implemented

str * int multiplication implemented
2022-05-24 15:31:36 +05:30
Thakee Nathees
e16debcff0
Merge pull request #235 from ThakeeNathees/more-methods
Some builtin class methods were added
2022-05-24 00:04:51 +05:30
Thakee Nathees
8e04748f86 some builtin class methods were added
- check a string contains another with `in` keyword
- Number: isint, isbyte
- String: find, replace, split, startswith, endswith, strip
- Map: clear, has, get, pop
- list: insert, clear, find, pop
- removed str_sub builtin function as its redunent since we have
  range slice over strings.
- moved lower, upper attributes of strings as methods
2022-05-23 23:47:28 +05:30
Thakee Nathees
b2c68d6064
Merge pull request #234 from ThakeeNathees/bytebuffer
More code enhancements (read bellow)
2022-05-23 04:23:06 +05:30
Thakee Nathees
2fd7b1f6e4 More code enhancements (read bellow)
- ByteBuffer, and Vector classes were created. However thier methods are
  limited, and to do.
- Strings supports new line escape "\\n".
- typename will return class name of an instance (was just 'Inst' fixed)
- _repr() method added. if _str method doesn' exists on an instance,
  it'll try to call _repr() to make a string.
- number.isint(), number.isbyte() method added
- [], []= operator were added.
2022-05-23 03:48:35 +05:30
Thakee Nathees
4072a06bd7
Merge pull request #233 from ThakeeNathees/warnings-fix
Minor code enhancements
2022-05-21 13:18:32 +05:30
Thakee Nathees
6a22653263 Minor code enhancements (read bellow)
- Warnings were fixed
- Libraries are registered internally when PKVM created
  and cleanedup when PKVM freed (if PK_NO_LIBS not defined)
- Lang.clock() moved to time module and sleep, epoch time
  were added.
- Support both upper case and lower case hex literals
- Support hex excaped characters inside strings (ex: "\x41")
- Native api for import modules added `pkImportModule(...)`
- pkAllocString, pkDeallocString are changed to pkRealloc.
- NewInstance, DeleteInstance functions now take PKVM however
  delete function should not allocate any memory since it's
  invoked at the GC execution.
2022-05-21 04:15:30 +05:30
Thakee Nathees
710d0c47f3
Merge pull request #232 from ThakeeNathees/amalgam
Amalgamation implemented
2022-05-20 13:41:11 +05:30
Thakee Nathees
e3cab82978 amalgamation added and libs moved to src/libs/ 2022-05-20 04:49:50 +05:30
Thakee Nathees
f613153dcb
Merge pull request #231 from ThakeeNathees/try-online
try online page added to docs
2022-05-19 00:40:07 +05:30
Thakee Nathees
97f9a364f3 try online page added to docs 2022-05-19 00:13:53 +05:30