Commit Graph

344 Commits

Author SHA1 Message Date
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
Thakee Nathees
ade5d9ee44
Merge pull request #230 from ThakeeNathees/native-call-api
native call api implemented
2022-05-18 15:27:15 +05:30
Thakee Nathees
22cecf4415 native call api implemented 2022-05-17 23:51:01 +05:30
Thakee Nathees
80896f04aa
Merge pull request #229 from ThakeeNathees/native-api
native instance interface implemented
2022-05-17 08:03:00 +05:30
Thakee Nathees
48089b2a1a native instance interface implemented 2022-05-17 07:08:14 +05:30
Thakee Nathees
2727f010ec
Merge pull request #227 from ThakeeNathees/native-globals
adding globals support in native interface
2022-05-09 23:32:27 +05:30
Thakee Nathees
b5d98ca4c3 adding globals support in native interface
pkSetGlobal function implemented to support adding globals from the
native interface. Also the PKVM slots doesn't need a runtime anymore to
use them (see math.PI global to see how it works).
2022-05-09 22:52:25 +05:30
Thakee Nathees
78b7004de6
Merge pull request #225 from ThakeeNathees/number-from-string
Number constructor from string
2022-05-09 16:04:16 +05:30
Thakee Nathees
b96b18a4d7 Number constructor from string 2022-05-09 15:25:44 +05:30
Thakee Nathees
6e66721b2e
Merge pull request #224 from ThakeeNathees/mini-impl
negative index, range slice and string concat (..)
2022-05-09 10:22:38 +05:30
Thakee Nathees
f5e2f15d23 negative index, range slice and more
... string concat with .. operator
    exponent operator with ** operator
2022-05-08 23:19:33 +05:30
Thakee Nathees
b908f85338
Merge pull request #223 from ThakeeNathees/docs-change
documentations are refactored
2022-05-07 17:54:32 +05:30
Thakee Nathees
a83aa9438e documentations are refactored
function keyword changed back to fn
2022-05-07 17:47:58 +05:30
Thakee Nathees
443bc8f6ac
Merge pull request #222 from ThakeeNathees/import-refactor
import statements are refactored.
2022-05-06 11:25:51 +05:30
Thakee Nathees
168f365cde import statements are refactored.
- all import statement (native or script file) have the same syntax
- allow relative (including parent directory) imports
- cyclic imports are handled by caching the scripts
- `import foo` can potentially import `<searchpath>/foo/_init.pk`
- * import are not supported anymore
2022-05-06 11:16:48 +05:30
Thakee Nathees
9dc2a99c3f
Merge pull request #221 from ThakeeNathees/native-interface
native interface refactored
2022-05-05 15:24:11 +05:30
Thakee Nathees
3c107d4da2 native interface refactored 2022-05-05 12:54:15 +05:30
Thakee Nathees
a9f57d9ec7
Merge pull request #220 from ThakeeNathees/leak-detect
Memory leak detection implemented
2022-05-03 19:25:31 +05:30
Thakee Nathees
1c7ddf07ad memory trace for vmRealloc implemented.
a little python script have written to check for memory leaks
from the trace report. Which is at scripts/leak_detect.py
2022-05-03 16:56:59 +05:30