Commit Graph

2531 Commits

Author SHA1 Message Date
Torsten Rüger 064bb2f90f Fix compilers link
link command varies on systems, hmm
2019-08-19 19:13:51 +03:00
Torsten Rüger 57b0ad2c32 Fix super as statement
Super is a statement, a send really.
Not an expression (as maybe in c++)
The actual implementation will be a bit tricky, like raise, a bit of stack walking, but not impossible. Still, later
2019-08-19 18:48:13 +03:00
Torsten Rüger 0e694a38f7 Implicit returns for class methods
gets us parsing of parfaits second file data_object
2019-08-19 15:56:15 +03:00
Torsten Rüger d5d1df951c Block/Lambda rework done
recovered from all renames and redoing the block compilation
all green
2019-08-19 15:23:57 +03:00
Torsten Rüger a722a4c285 Move vool block compilation into constant generation
When the lambda is passed as argument, it must be moved. This triggers the generation of a corresponding parfait object (as before, and as for other constants) but now also triggers the code build. The code being the constant as it were
Also some more name fixes from renames
2019-08-19 14:33:02 +03:00
Torsten Rüger 3ddf2e3837 Redoing ruby block conversion
Since the block is actually a constant, it does not need assignment or special hoisting
Just use the send and stick the lambda in as last arg
2019-08-19 14:23:55 +03:00
Torsten Rüger f87526f86f Renaming Vool exppressions rightly
Class, Method and Lambda (was block) are expressions.
Just making things clearer, especially for the blocks (ahem, lambdas) is matters.
wip
2019-08-19 11:33:12 +03:00
Torsten Rüger ae16551ed0 Rename Vool Block to Lambda
Making the distinction clearer
Some fixing of previous (wip)
2019-08-19 10:40:22 +03:00
Torsten Rüger 02807cf6f9 Rename Block to RubyBlock at Ruby level
The parser presents the whole call that defines the block as a block. And so does the Ruby layer, as we don't want to do processing in ast.
Just making it clearer, also Vool:: block will have to be renamed
2019-08-19 10:31:11 +03:00
Torsten Rüger 4f3d117e40 Object dogfood, compiling parfiat to binary
Object is the first (obviously) Parfait object to parse and fully compile to binary.
No tests yet, but almost 500 lines of real world code with 17  methods, not bad
2019-08-18 20:41:49 +03:00
Torsten Rüger ee8927b059 Fix slot access for constants
Type access is allowed for any object, including constants.
Needed for parfait
2019-08-18 20:35:01 +03:00
Torsten Rüger 5a80850975 still debugging travis (for arm tests) 2019-08-18 15:40:40 +03:00
Torsten Rüger 6547b1608d Ok, any fail makes it go red, now i know
also making command configurable as they seem different on ubuntu (16?) 
than fedora 30 (and who knows where else)
2019-08-18 15:30:52 +03:00
Torsten Rüger 02a4742cc2 Backticks raise exception, who knew
catching and tryig different exe name
2019-08-18 15:22:09 +03:00
Torsten Rüger c9d77a29b2 Running tests on binary through qemu (system, no ssh) 2019-08-18 12:39:23 +03:00
Torsten Rüger 3fa696b527 testin travis 2019-08-18 11:07:39 +03:00
Torsten Rüger 15d1c07a1c Remove dead code
some copy paste in creating full mom layer left dome unused (untested) 
code
thanks to code climate stats
2019-08-18 10:19:52 +03:00
Torsten Rüger 5a43cbff15 Fixing tests for implicit return
previous commit affected rather many test, as the implicit returns add extra instructions
Also added some explicit returns, so as not to test the return logic too much. return (ie return nl) is a knonwn 3 risc operation.
2019-08-17 23:29:42 +03:00
Torsten Rüger 32f908c127 Adding simple implicit return
Ruby return semantics are easy to grasp, not so easy to code. So many cases.
Added support for common cases, return const/variable or call.
2019-08-17 23:27:55 +03:00
Torsten Rüger 4c76ff3388 Remove Padded module
Parfait was depending on it, ie it created a dependency out of Parfait. But Parfiat needs to be self contained.
Moved 2 methods into parfait object, and resolved single call from text_writer to third.
2019-08-17 21:07:07 +03:00
Torsten Rüger ae7f31381b Fixing self type creation
When compiling a classs, we pick up all instance variables.
Now that conditions and returns can be calls, that was broken, now fixed
2019-08-17 15:58:27 +03:00
Torsten Rüger d3f3c91ae5 Fix all but one test
Riples upon riples. The one left looks like the genuine article
2019-08-16 21:43:54 +03:00
Torsten Rüger 7c91a08d5b Fix vool assignments after call rework
also small fix for if and return, as they need to execute sneds and yields (not just sends), so testing for Call not SendStatement
2019-08-16 20:39:08 +03:00
Torsten Rüger e6c30d98fb Fix if statements hoisting, now that send is working
Same same, just have to remembe to actually execute the condition if it is a send
Having send a possible expression, removes one tmp variable and associated move, for a little extra work.
Next return and assign (rest)
2019-08-16 18:42:57 +03:00
Torsten Rüger dee1e24c28 Fix ruby receiver to vool
for chained calls to be normalized correctly
2019-08-16 16:05:45 +03:00
Torsten Rüger c213cf874b Fix ruby normalising to_vool
So that vool layer never has complex conditions or returns
Start with while, next if, return and assign
2019-08-16 14:20:06 +03:00
Torsten Rüger 84b9811e55 Fixing ruby send with arguments
When send has complex args, mostly more sends, we hoist those out and pass created temporary variables
2019-08-15 21:30:36 +03:00
Torsten Rüger 31ae0a9670 Add support for unless
ifs without a true branch would crash before
Somewhat more verbose but unified
2019-08-14 22:24:35 +03:00
Torsten Rüger d6c38d15ba Fix calling unknown methods
Before, when the type was determined, it was assumed that the method can be resolved. But off course tis is not true, as methods may be defined later in the file.
Two solutions for that. One could  (and should) define all methods and only then start to compile. Thus having the type safety.
Or (as now) make a dynamic call and let it fail at runtime.
2019-08-14 14:59:54 +03:00
Torsten Rüger 1dad6dee7a Merge branch 'new_mom' 2019-08-14 11:14:58 +03:00
Torsten Rüger b2260d856d And we are green again
After having over 600 failing tests at one point, this does feel good.
Even better, most of the risc/interpreter tests where i didn't change anything came gree without changing the tests. ie we have binary compatibility.
2019-08-14 11:11:26 +03:00
Torsten Rüger c13a8ceb11 all of mom and vool
with working block tests this time
2019-08-13 20:35:27 +03:00
Torsten Rüger 155c042009 Fix forgotten block compiler
Especially on the way down to risc
2019-08-13 19:32:17 +03:00
Torsten Rüger 8036b23593 Fixed more disabled tests 2019-08-13 11:14:36 +03:00
Torsten Rüger aaf169ad8d Fixed almost all but Interpreter
150 only failing, seems only 1 bug though
and one in linker
2019-08-13 00:13:29 +03:00
Torsten Rüger 9474932320 fixing risc collection tests 2019-08-12 16:12:17 +03:00
Torsten Rüger 9a2716280c Extracting the mom instruction from builtin modules
Since they were embedded at first (easier copy/paste) they now got own files, like their brethren
also mini tests for each instruction , nice start
2019-08-12 13:16:15 +03:00
Torsten Rüger fa0aa30386 Move builtin wholesale to Mom
Since Builtin generates risc, just like mom instructions, it was a design mistake to put builtin into risc in the first place. Now that borders are coming more into focus, it make much more sense to have the builtin in mom.
In fact the instructions should be moved out and a seperate invocation mechanism used , so functions can be parsed, not generated (wip)
2019-08-12 12:38:29 +03:00
Torsten Rüger a4b6f29834 Booting functions again and send test
both class and normal sending tests at vool / mom level
2019-08-12 11:57:32 +03:00
Torsten Rüger 2326081161 Now booting all original methods
Just need to refactor now
2019-08-12 11:31:47 +03:00
Torsten Rüger 91ddae2251 Start to convert integer operations
All apart from operators, which are its own thing
2019-08-12 11:08:09 +03:00
Torsten Rüger 97488c4e5b Transform builtin word functions
according to same schema
2019-08-12 10:45:07 +03:00
Torsten Rüger 3282e0ae06 transformed object builtins 2019-08-11 20:36:10 +03:00
Torsten Rüger 0725f02e9a starting to fix builtin
start at Object get_interna_word
using the pattern to replace the whole risc method with a single mom instruction. Copying the original risc code into the instrucitons to_risc
also adding some very basic tests
2019-08-11 14:31:00 +03:00
Torsten Rüger 0b59c95218 more test fixes and more to do 2019-08-10 21:59:31 +03:00
Torsten Rüger 213938075f fix most mom and risc apart
apart from things involving builtn, which is not yet conceptually solved (as it codes risc, not mom)
2019-08-10 21:30:00 +03:00
Torsten Rüger d5f89a4979 compile from mom compiler to risc 2019-08-10 12:42:47 +03:00
Torsten Rüger 5994cd3276 starting on mom to risc
some docs too
2019-08-08 12:19:27 +03:00
Torsten Rüger 82c9f1d97f more and better tests
especially vool
2019-08-08 12:18:36 +03:00
Torsten Rüger d5625a70d7 fix a whole bunch of vool to_mom
All but those requiring boot functions
2019-08-07 15:09:26 +03:00