Commit Graph

265 Commits

Author SHA1 Message Date
Thakee Nathees
4d46930d1b instance and class type cleaned
this is a part of the class implementation. In this commit classes
and instances type were completely cleaned and prepared for a new
implementation. Native class registering mechanism were fully refactored
and made it much simpler.
2022-04-20 14:40:08 +05:30
Thakee Nathees
29be68fc86 classes were removed temproarly
to implement classes properly and support methods I had to remove
the older class syntax temproarly.
2022-04-20 13:54:45 +05:30
Thakee Nathees
48102123af
Merge pull request #205 from ThakeeNathees/cleanups
dlfcn removed and minor code cleanups
2022-04-20 13:28:05 +05:30
Thakee Nathees
1f8a71fe0a dlfcn removed and minor code cleanups 2022-04-20 13:08:14 +05:30
Thakee Nathees
2262089948
Merge pull request #203 from ThakeeNathees/syntax-change
function and else if keywords are changed.
2022-04-17 07:49:52 +05:30
Thakee Nathees
88c45cccac function and else if keywords are changed.
- `func` keyword has change to `function`.
- `elsif` changed to `else if`
2022-04-17 07:33:40 +05:30
Thakee Nathees
c67572d552
names buffer merged with constant pool (#202)
a buffer of classes for primitive types added to PKVM, but they'll
not be initialized in this commit.

names buffer and constant pool of a module are now merged (just like
java's constant pool).

VM's core libraries and scirpt modules are merged into a single
map name modules.

creating a new module doesn't register it automatically anymore,
you need to call pkRegisterModule(...) each time.

newModule() function refactored with a simpler interface, we're not
setting path or registering globals anymore, the caller is
responsible for that.
2022-04-17 06:47:27 +05:30
andrea321123
f980e91b60
Handle Ctrl+D, Ctrl+Z properly
* Fix #105

* Check if last char is EOF
2022-04-16 15:24:55 +05:30
Thakee Nathees
925ba3504d
Merge pull request #201 from ThakeeNathees/tcc-build
tcc build supported.
2022-04-16 09:56:19 +05:30
Thakee Nathees
d8d229b0fb tcc build supported.
inorder to support tcc, I need to remove some math functions that
tcc on windows doesn't support (v language is using openlibm).
This is temproarly and the math functions should be moved to it's
own math script module once the import system is refactored.

TCC build tested with the binary downloaded from --
https://download.savannah.gnu.org/releases/tinycc/tcc-0.9.27-win64-bin.zip
(download link from the https://bellard.org/tcc/ website), and this
should be added to the CI workflow.
2022-04-16 09:37:38 +05:30
Thakee Nathees
34622afc0b
Merge pull request #199 from ThakeeNathees/modules
modules were moved to cli/modules
2022-04-16 07:35:28 +05:30
Thakee Nathees
5aee9616c1 modules were moved to cli/modules
now it's easier to re-use cli modules into another hosting
application and a little python script have added to generate
native api to support native extension library.
2022-04-15 19:30:26 +05:30
Thakee Nathees
ec569aba74
Merge pull request #198 from ThakeeNathees/minor-refactor
Yet another refactor.
2022-04-15 10:11:36 +05:30
Thakee Nathees
ddc8bd8197 yet another refactor.
This commit doesn't change any behavior, just moving the code
around cleaning things.
2022-04-15 09:58:02 +05:30
Thakee Nathees
6083af6dbe
Merge pull request #197 from ThakeeNathees/minor-changes
fiber pointer stored as register variable
2022-04-14 16:30:21 +05:30
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
9d6d37fa09
Merge pull request #196 from ThakeeNathees/upvalue
Closures implemented
2022-04-14 05:07:50 +05:30
Thakee Nathees
8d062e38b8 closures were completely added. 2022-04-13 14:31:57 +05:30
Thakee Nathees
2e1d8d89dd lexical scoping support using upvalues 2022-04-13 09:20:56 +05:30
Thakee Nathees
9a8f3365ad
Merge pull request #195 from ThakeeNathees/expr-name
exprName re-defined
2022-04-13 09:04:58 +05:30
Thakee Nathees
e0852139b9 exprName re-defined
The exprName function re-defined into a cleanner way, and now it's
possible to override builtin functions, this will come in handy
to introduce upvalues.
2022-04-13 08:40:37 +05:30
Thakee Nathees
e5d881fc40
Merge pull request #194 from ThakeeNathees/upvalue
local variable index miss-calculation bug fix
2022-04-13 03:20:37 +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
db9fad35a9
Merge pull request #193 from ThakeeNathees/fn-closure-replace
functions are replaced with closures
2022-04-12 13:45:27 +05:30
Thakee Nathees
3feb9ac723 functions are replaced with clsoures
Every occurrence of function as first classes citizen is replaced
with closures yet upvalues are still to do.
2022-04-12 07:28:33 +05:30
Thakee Nathees
3b5da9cad3
Merge pull request #192 from ThakeeNathees/script-type-rename
Scripts renamed to Modules
2022-04-12 01:26:39 +05:30
Thakee Nathees
20b99c60b3 script renamed to modules
The name script is missleading as it only refering to the scripts
(the files that contain the statements) where as it could also
be the native module objects containing collection of native
functions.

After this commit, native functions can also have set owner module
and it won't be as confusing as before.
2022-04-11 14:08:00 +05:30
Thakee Nathees
133a560283
Merge pull request #190 from ThakeeNathees/fn-cls-moved-constants
functions and classes are moved to constants buffer
2022-04-11 04:40:57 +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
98643e7fd1
Merge pull request #189 from ThakeeNathees/fn-cls-moved-constants
literals renamed to constants
2022-04-10 06:20:26 +05:30
Thakee Nathees
05a516d47d literals renamed to constants
Since the functions and classes will be moved to the constants buffer
rather than having their own (function buffer and class buffer) the
rename is essential, and to make the refactoring process easier all the
intermediate steps are done with its own pr.
2022-04-10 06:11:50 +05:30
Thakee Nathees
a69718b020
Merge pull request #187 from ThakeeNathees/closure-type-added
closure and upvalue type were added.
2022-04-09 06:42:40 +05:30
Thakee Nathees
9dade8313f closure, upvalue type were added.
It's just the types that were added and only object creation
and garbage collection of that types are implemented, the
reset of the implementation is not part of this commit.
2022-04-09 00:40:50 +05:30
Thakee Nathees
28567f53a7
Merge pull request #186 from ThakeeNathees/debug-dubmp-refactor
debug dump are now directly prints to stdout
2022-04-08 00:48:10 +05:30
Thakee Nathees
c1d36c666c debug dump are now directly prints to stdout 2022-04-07 23:09:30 +05:30
Thakee Nathees
d3bcbfb779 try-online output changed to <pre> tag 2022-04-07 16:47:22 +05:30
Thakee Nathees
bdd619c859
Merge pull request #184 from ThakeeNathees/extract-subtype-parser
parsing context are moved to struct Parser
2022-04-07 09:28:05 +05:30
Thakee Nathees
c89db94256 parsing context are moved to struct Parser 2022-04-07 08:58:51 +05:30
Thakee Nathees
5a0690aa4a
Merge pull request #183 from ThakeeNathees/minor-refactor
pk_var changed to pk_value and some minor changes
2022-04-07 06:17:53 +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
dfd1c5a612 false positive assertion crash -- fixed 2022-04-06 19:08:07 +05:30
Thakee Nathees
adcd7dce45 Merge pull request #180 from ThakeeNathees/minor-changes
Stack miss calculation bug fix & minor changes
2022-04-06 11:26:32 +05:30
Thakee Nathees
2bc09f41e5 Stack miss calculation bug fix & minor changes 2022-04-06 08:56:51 +05:30
Thakee Nathees
862c6a43c9
Merge pull request #179 from ThakeeNathees/docs-try-online
Docs try online
2022-04-06 02:38:37 +05:30
Thakee Nathees
2be049f3fd try online page created 2022-04-06 02:33:21 +05:30
Thakee Nathees
ee2d87555a sources were refactored 2022-04-05 19:21:12 +05:30
Thakee Nathees
7704a2df1a
Merge pull request #178 from ThakeeNathees/string-interpolation
String interpolation
2022-04-05 10:39:31 +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