Commit Graph

1257 Commits

Author SHA1 Message Date
Torsten Ruger
da4a1af074 modulize return and list 2016-12-09 14:19:22 +02:00
Torsten Ruger
99132a92b6 modulize operator_expression 2016-12-09 14:17:01 +02:00
Torsten Ruger
037fd722df clean up function definition, now function statement 2016-12-09 14:12:41 +02:00
Torsten Ruger
059fb38f08 modulize field_access and field_def 2016-12-09 14:04:06 +02:00
Torsten Ruger
4da13c3867 move ast to tree, remove seperate helper file 2016-12-09 13:56:13 +02:00
Torsten Ruger
bab2fe32df modulize class_field and class_statement 2016-12-09 13:46:26 +02:00
Torsten Ruger
2b008dd3da modulize basic_value 2016-12-09 13:40:10 +02:00
Torsten Ruger
fa14e35a50 refactor if_statement 2016-12-09 13:38:07 +02:00
Torsten Ruger
1e7093c63f remodel assignment a bit 2016-12-09 13:20:48 +02:00
Torsten Ruger
395fd2d701 refoactor call site some 2016-12-09 12:22:37 +02:00
Torsten Ruger
224670e449 refactor name expression for compiler 2016-12-09 12:13:33 +02:00
Torsten Ruger
ca4bdcc528 gets rid of soml-parser completely 2016-12-08 20:13:08 +02:00
Torsten Ruger
e2236cf703 move soml ast here, now called type as the language is going 2016-12-08 19:38:50 +02:00
Torsten Ruger
da553f996f move compiler to typed
starting to get rid of soml, bit by bit
2016-12-08 15:25:20 +02:00
Torsten Ruger
c3a28d2abc small collector change 2016-12-08 15:19:37 +02:00
Torsten Ruger
a31f75fe93 basic immutability for type
add_instance_variable now uses global type list to check
adds hash and to_has functions
use backdoor (send) for booting
2016-12-08 12:50:25 +02:00
Torsten Ruger
137d3c9231 add each_with_index to indexed 2016-12-08 12:48:39 +02:00
Torsten Ruger
ad91c0a4bf add inspect method to dictionary 2016-12-08 12:48:08 +02:00
Torsten Ruger
2741f35380 add a each_pair to indexed and use in types 2016-12-07 23:35:51 +02:00
Torsten Ruger
266a04040b add types hash to space 2016-12-07 23:34:45 +02:00
Torsten Ruger
bcba3ed3b2 move parfait to new module 2016-12-06 16:50:54 +02:00
Torsten Ruger
3ed0c4829a log test 2016-12-06 16:44:04 +02:00
Torsten Ruger
adca8b21c1 move soml tests out, small cleanup 2016-12-06 15:08:29 +02:00
Torsten Ruger
5ac14ddccc update gems and fix tests 2016-12-06 12:08:18 +02:00
Torsten Ruger
4b05b48197 some docs 2016-12-06 11:38:09 +02:00
Torsten Ruger
229f5896c6 update to use new ast
soml was updated to have a typed ast layer to make programatic creation
easier
this brings LOTS of syntax change with it, that does not really mean
anything at all
All tests pass again so back to the same
2016-03-07 11:55:28 +02:00
Torsten Ruger
d7b210d63a update parser 2016-03-06 10:48:14 +02:00
Torsten Ruger
a8b815117f rename object_type to instance_type
for better distinction that it is not every object
but only instances of the class
2016-02-25 12:16:13 -08:00
Torsten Ruger
278d71b56c fix docs for rename 2016-02-25 12:03:11 -08:00
Torsten Ruger
d32b51c67b rename layout to type
this one goes to caleb for pointing it out.
Much better word
2016-02-25 11:50:10 -08:00
Torsten Ruger
3480b97eaa rename variable type to value_type
in preparation for next rename
2016-02-25 11:41:03 -08:00
Torsten Ruger
afe16868b5 more some tests 2015-11-30 16:10:08 +02:00
Torsten Ruger
dc560aaa5e move main to space 2015-11-30 16:09:12 +02:00
Torsten Ruger
d0b655d05f implement the div10 as assembler
easy after the some version worked
because it’s not arm it probably twice as long as need be
better (any?) optimisation would take care of that
still, nice to see it works
2015-11-21 14:20:25 +02:00
Torsten Ruger
ffc69fd2a5 add the hackers delight version of div10
better test too
remove remnants of 64bit multiplication
2015-11-21 14:19:07 +02:00
Torsten Ruger
91a0365c2e fix register shortcuts 2015-11-21 14:17:54 +02:00
Torsten Ruger
96972dab29 thats most of the benchmarking
strange about the puts in soml, hard to see where a factor of 10 would
come from
2015-11-20 23:51:58 +02:00
Torsten Ruger
da4003c30a ruby fibs versions and tests for them 2015-11-20 19:12:58 +02:00
Torsten Ruger
02d9a063b0 fix both parfait words to have same indexing 2015-11-20 13:25:49 +02:00
Torsten Ruger
aabde4b9a6 fix word indexes on arm
which affected offsets in the ruby side too
the hidden dead word needed accounting for
2015-11-19 16:40:00 +02:00
Torsten Ruger
a8453c126d use arm shift at runtime
arm indexes are in bytes (x4) at compile time
but at runtime we only have the array indexes, iw word indexes
arm has the nice barrel shifter to save us an extra instruction
2015-11-19 12:48:13 +02:00
Torsten Ruger
4871a52d37 better error reporting for parser 2015-11-19 10:10:13 +02:00
Torsten Ruger
249f43ad34 translate and interpret new instructions 2015-11-19 10:09:55 +02:00
Torsten Ruger
ac5a7ac4ca making parfait (both) use the new byte functions 2015-11-19 10:09:24 +02:00
Torsten Ruger
dffa3fbf42 adding word functions for byte access 2015-11-19 10:08:41 +02:00
Torsten Ruger
ff65952a3e add get/set byte instructions
it seems all cpus have them anyway so best use them
it was a pain to do this on word level, hard to write, hard to debug and
quite unnecessarily slow
2015-11-19 10:07:27 +02:00
Torsten Ruger
5369dc3d52 rename get/set internal
to _word , because _byte versions are coming
2015-11-18 15:36:43 +02:00
Torsten Ruger
979660f282 move parfait into register
register layer uses parfait models to generate object space
so parfait  should be part of register (not above it)
2015-11-18 12:04:25 +02:00
Torsten Ruger
2bc2d4486f move interpreter to register
seems more where it belongs, since it interprets the register machine
instructions
2015-11-18 12:00:30 +02:00
Torsten Ruger
40d81681b5 move parfait adapter into parfait ruby
in the future parfait will be coded in some and translated back into
ruby to “adapt”
until then, all ruby code is the adapter
2015-11-18 11:55:29 +02:00
Torsten Ruger
0643b96641 update arm
and small code changes from the fact that just loading a variable does
not change status flags
2015-11-17 02:28:47 +02:00
Torsten Ruger
303b7eb1f8 putstring unfolds length
which means sys call doesn’t need to
and also interpreter sometimes gets a symbol length
2015-11-16 18:03:29 +02:00
Torsten Ruger
f50d7b57a4 fix the putstring sys call indexing
index 0 is the marker word , so like in some, all indexes 1 based
works :-)
2015-11-15 22:03:06 +02:00
Torsten Ruger
8e82da0b61 fix arm (assembled) indexing
by having a dummy 0 index in salaam. when assembled
2015-11-15 20:42:07 +02:00
Torsten Ruger
9a2fe42167 change assembly order
first objects, then methods.
methods change length, so at least this way objects stay
did mean hacking the arm code (something for later)
2015-11-15 16:24:43 +02:00
Torsten Ruger
458610b970 implement string length 2015-11-15 11:28:16 +02:00
Torsten Ruger
1633bf1289 fix position check
as programs get bigger the distance gets bigger
needs better approach
2015-11-15 00:38:23 +02:00
Torsten Ruger
9602acf3d2 fix label positions 2015-11-15 00:36:15 +02:00
Torsten Ruger
cea60f202a small label changes 2015-11-15 00:35:43 +02:00
Torsten Ruger
b30cf21bbd fix arm indexes
needs rethought
fixed for static use, but what about dynamic
2015-11-15 00:35:12 +02:00
Torsten Ruger
cc9b515752 fix double label names 2015-11-14 22:53:01 +02:00
Torsten Ruger
278eccbed5 derive binary code form word
long ago hacked the binary code to use integers (thus forsaking correct
arm binaries)
Finally fix by deriving from Word which now has correct binary access
Dumped binary.name in the process, that is available from the method
2015-11-14 15:04:04 +02:00
Torsten Ruger
8fa92515b5 update arm and small arm fixes
constants in arm chunks, needs better solution
2015-11-14 13:05:49 +02:00
Torsten Ruger
dbcd39c277 helper do get the register no as int for arm 2015-11-14 00:22:23 +02:00
Torsten Ruger
6e7c6d814a long const avoidance
arm can only load 10 bits and some funny logic
so for now avoid big fffffff const
2015-11-14 00:21:24 +02:00
Torsten Ruger
6127d92ca9 implement arm branches
which backfired into interpreter as
plus actually means 0 or plus in arm
may still change back but for now
2015-11-14 00:20:03 +02:00
Torsten Ruger
9ab3de234d some helper functions
for when i started the assembler div10
in the end i did the div10 in some, so no need
2015-11-13 20:47:08 +02:00
Torsten Ruger
4a8bb32039 serious bit fiddling, div10 using shift magic
forgot that arm has no division (or respectively only later models have)
many magic formulae out there, none seem to work 1000% on the
interpreter. some big 0 ending numbers are 1 off.
2015-11-13 20:46:27 +02:00
Torsten Ruger
f779b5d15f fix interpreter to simulate 32 bit machine 2015-11-13 20:31:35 +02:00
Torsten Ruger
5c862111b9 remove div and add div10
general division is for another day, the 10 version is manageable
also same code produces mod10
wip
2015-11-12 20:03:57 +02:00
Torsten Ruger
a5afca10f6 don't pass machine around, its global 2015-11-12 20:02:44 +02:00
Torsten Ruger
6f0d6d831e update arm and implement most operators
multiplication wasn’t implemented
and division isn’t part if arm
neither is rotate by register
2015-11-12 20:02:14 +02:00
Torsten Ruger
787f727974 simplify i to_s 2015-11-11 20:45:40 +02:00
Torsten Ruger
6137833140 change args argument to create method to be hash
was array and didn’t carry types and names
2015-11-11 20:41:02 +02:00
Torsten Ruger
351a747bfd mod and div for int 2015-11-11 20:36:40 +02:00
Torsten Ruger
1e7935bf85 implement byte access for some word
wouldn’t have been possible without the ruby version
2015-11-11 20:36:07 +02:00
Torsten Ruger
9bfc9cf6c2 implementing missing operators 2015-11-11 20:34:49 +02:00
Torsten Ruger
d870553a1f make ruby word byte size
was hacked as int
interestingly zero change to tests
2015-11-11 19:11:08 +02:00
Torsten Ruger
93ff44bb6f improve reinit of interpreter 2015-11-10 19:28:31 +02:00
Torsten Ruger
1efa36ed4f string sometimes gets to_s in equal while half cooked
during debugger register change or update to be precise.
without the debugger there would be no access to the word
at that point and no need for this hack
2015-11-10 19:16:38 +02:00
Torsten Ruger
daffa0579e another opal hack
in opal 13 / 10 = 1.3 whereas in ruby its 1
2015-11-10 19:10:11 +02:00
Torsten Ruger
c92814440f fix integer to_s and put, with tests 2015-11-10 19:09:17 +02:00
Torsten Ruger
760a4beb86 fix some word with tests 2015-11-10 19:08:48 +02:00
Torsten Ruger
6c2ce66bfc fix old warning 2015-11-10 11:48:53 +02:00
Torsten Ruger
a730dd0c99 fix some, return missing
must write no return error code
2015-11-09 23:29:35 +02:00
Torsten Ruger
70f912f94c allow message as keyword to access current message
the ultimate in meta-programming
2015-11-09 23:29:14 +02:00
Torsten Ruger
a20f1570ee temporary word hack to make it look liked indexed 2015-11-09 23:28:40 +02:00
Torsten Ruger
5d80c38c87 correct register types 2015-11-09 23:28:10 +02:00
Torsten Ruger
9ab7b476d5 opal fix and minor 2015-11-09 23:27:15 +02:00
Torsten Ruger
368263d5a5 rewrite of field access using on_name
much cleaner and revealed a bug
2015-11-09 23:26:37 +02:00
Torsten Ruger
dd7973875c fix interpreter to handle registers in set 2015-11-09 23:25:34 +02:00
Torsten Ruger
9075f1af37 fixes yet another order dependant bug in the test (not the code) 2015-11-09 10:04:37 +02:00
Torsten Ruger
b2de1c6d79 minor fixes 2015-11-08 23:58:54 +02:00
Torsten Ruger
f746218765 reinstate word creation and use for strings
so string constants become words, so we can fiddle with them
2015-11-08 23:58:35 +02:00
Torsten Ruger
c8fa5238ee stdout word too 2015-11-08 23:57:38 +02:00
Torsten Ruger
6b9c472bec refactor load_parfait
so debugger can grab and wire it easily
2015-11-08 18:35:10 +02:00
Torsten Ruger
6f69995284 stab at inter to string
wip
2015-11-08 17:11:03 +02:00
Torsten Ruger
c38775e933 add set_internal
and the set_slot with register
very much like the get_slot for get_internal
2015-11-08 17:10:36 +02:00
Torsten Ruger
64d99d5e68 didn't need big decimal require 2015-11-08 15:18:39 +02:00
Torsten Ruger
d6108e7b3a fix interpreter overflow issue
flag set for bigness, result reduced
tests for + and *
fixed fibs tests
2015-11-08 15:15:55 +02:00
Torsten Ruger
6ea698d397 save some to_s code 2015-11-08 14:30:42 +02:00
Torsten Ruger
37564d9c2e implement message pseudo variable (like self)
too easy
also simplified some tests
2015-11-08 13:55:38 +02:00
Torsten Ruger
69918c8e88 add some message and remove fields
those fields are already present in the classes
(in the future they should be defined in some and integrated to ruby,
but that would mean parsing to boot and parsing doesn’t yet work on
opal)
2015-11-08 13:54:58 +02:00
Torsten Ruger
502cfa357d implement and test field access 2015-11-08 13:39:13 +02:00
Torsten Ruger
b443103ea4 using class fields
instead of internal_get
2015-11-08 01:02:47 +02:00
Torsten Ruger
9fd7c79cfb mixed up class and meta, fixed 2015-11-08 00:55:10 +02:00
Torsten Ruger
bcc366f8fd bit more soml 2015-11-08 00:54:47 +02:00
Torsten Ruger
3e4dcd35c7 better no method no super handling
also revealed bug in booting
2015-11-08 00:54:24 +02:00
Torsten Ruger
5ddc96718b slight call logic modification
simplification, new model is such that the upon start the method:
has a message in r0, works on it and returns to the return address.

Everything else is up to the caller
2015-11-07 21:59:39 +02:00
Torsten Ruger
f2c7ed827d simplify the __init
admittedly more source code, but half the runtime
mainly just using message (not new)
made possible by call sequence change
2015-11-07 21:58:19 +02:00
Torsten Ruger
2315ad6920 minor cleaning 2015-11-07 21:55:04 +02:00
Torsten Ruger
8c68ffc7a4 fixing indexes makes test work
forgot my own rule: all parfait works in 1 based lists
2015-11-07 20:10:55 +02:00
Torsten Ruger
a1aa6b58ac resolve methods, don't just get them
i.e. down the ladder we go
2015-11-07 19:39:15 +02:00
Torsten Ruger
7523bac80a add layout and class accessor and test 2015-11-07 19:38:52 +02:00
Torsten Ruger
484e2d19d4 allow for registers in get slot 2015-11-07 19:38:03 +02:00
Torsten Ruger
1d07c1fb95 fix super class with name mixup 2015-11-07 19:37:38 +02:00
Torsten Ruger
37928b8591 rename internal get/set functions
mainly because the salaam parser chokes on internal…
2015-11-07 17:40:59 +02:00
Torsten Ruger
50b03a5e94 load parfait soml files
No dir glob for precise order
2015-11-07 17:38:27 +02:00
Torsten Ruger
d878ce00d8 framework for parfait runtime testing
with interpreter for now
later with arm exec support
2015-11-07 17:37:41 +02:00
Torsten Ruger
708cdace17 implement indexed object access
one of the few functions that can’t be coded
(or the design specifically is such that it can’t, in c it would be
self[index],
or, worse *(self + index) )
2015-11-07 17:36:28 +02:00
Torsten Ruger
35afe88ede allow get_slot with two registers
before was register and number, but for runtime that doesn’t work
2015-11-07 17:34:41 +02:00
Torsten Ruger
9ebe28450b add global variable space
could in the long run move spaces functionality to the class
and since the class is global anyway, wouldn’t need this
2015-11-07 12:19:04 +02:00
Torsten Ruger
fd7e4afb2f small meta related changes 2015-11-07 00:14:10 +02:00
Torsten Ruger
46e1a112ab metaclass moves down to object 2015-11-07 00:12:17 +02:00
Torsten Ruger
204200b92a metaclass is back
this time with a real purpose and implementation as the intermediary
As the interface to the layout and for replacing an edited layout
2015-11-07 00:11:56 +02:00
Torsten Ruger
ebcc15d314 testing fibo 2015-11-06 14:24:57 +02:00
Torsten Ruger
4eb3d9029a use logger 2015-11-05 16:50:00 +02:00
Torsten Ruger
13d0747b45 test the log_level too 2015-11-05 14:05:12 +02:00
Torsten Ruger
aad50021fe more messages for recursive fibs 2015-11-05 12:23:11 +02:00
Torsten Ruger
4014ad27fe fix and test return
return was in the wrong message
better tests now
2015-11-05 12:22:48 +02:00
Torsten Ruger
ff759bf0c1 increase message size
message size is somewhat like stack size,
but 1-1 related to how deep it can be, now 50 calls
2015-11-05 12:12:15 +02:00
Torsten Ruger
642dcb065a fix while statement
logic was broken, or inversed
had to lay the code out a bit funny, but it works and makes sense
2015-11-04 20:23:26 +02:00
Torsten Ruger
ab2c73f42c right name for return label makes interpreter work 2015-11-04 20:22:28 +02:00
Torsten Ruger
691ae96d71 fix names of branch codes
also store objects in register, avoid the whole object_id thing which
just lead to unclarity about class
2015-11-04 20:22:03 +02:00
Torsten Ruger
428faad25f opal fix for indexes 2015-11-04 16:11:25 +02:00
Torsten Ruger
b5e733cd11 finally simple logging
instead of commenting puts
2015-11-04 11:48:51 +02:00
Torsten Ruger
2236065d02 position filling after the padding changes, works again 2015-11-04 10:34:58 +02:00
Torsten Ruger
c87682b77f fix padding
used to be that type and layout were hidden
now type is gone and layout is an explicit instance, so 0 overhead
2015-11-04 10:34:03 +02:00
Torsten Ruger
5bddbfbb62 rename word_length to padded length
with word_length i was never sure if it was the padded version or not
2015-11-04 10:33:10 +02:00
Torsten Ruger
6ada815735 first stab at fixing the assembly
lots of length fiddling
wip
2015-11-03 16:24:12 +02:00
Torsten Ruger
0f8f0a681c fix padding to only consider layout (1 word) 2015-11-03 16:22:50 +02:00
Torsten Ruger
ca1dc36e3d method marking for labels 2015-11-03 16:22:24 +02:00
Torsten Ruger
6882f39645 fixing lengths 2015-11-03 16:21:50 +02:00
Torsten Ruger
c15445a958 let labels be constants 2015-11-03 16:20:25 +02:00
Torsten Ruger
5a8d7d313f little more tests 2015-11-03 11:23:15 +02:00
Torsten Ruger
c940e25f91 other half of previous call change 2015-11-03 11:22:52 +02:00
Torsten Ruger
1be5d1862f need to collect labels for return
so the interpreter can find the object
2015-11-03 11:22:26 +02:00
Torsten Ruger
bc414fd3e8 function call now saves the return address before calling
that means SaveReturn is obsolete (breaks loads of tests)
first step towards multi - return which obviously can not have the
callee save return address.
In fact this would make FunctionCall redundant too, as it is really
just a branch
2015-11-03 11:20:49 +02:00
Torsten Ruger
cffbc91821 fix field_def to new syntax 2015-11-02 21:27:37 +02:00
Torsten Ruger
45bd4bfdc6 remove save return 2015-11-02 20:11:12 +02:00