Commit Graph

909 Commits

Author SHA1 Message Date
Torsten Ruger
cf87c5323d using the next field of blocks for a consecutive code line 2014-05-22 13:59:47 +03:00
Torsten Ruger
e3bccaa0fe thats putstring working again (better testing == better code => better sleep, longer life :-) 2014-05-21 21:27:05 +03:00
Torsten Ruger
587fd56300 remove a layer of indirection 2014-05-21 21:15:23 +03:00
Torsten Ruger
bc278a61eb using function args for call 2014-05-21 21:12:46 +03:00
Torsten Ruger
65cde70114 add space at file end 2014-05-21 21:08:15 +03:00
Torsten Ruger
46102e56ad rename c to register machine 2014-05-21 19:43:46 +03:00
Torsten Ruger
937f566b27 value is not derived from code (was too much generalisation/confusing) 2014-05-21 19:41:51 +03:00
Torsten Ruger
067cde8d43 remove remnant of old dsl 2014-05-21 19:34:58 +03:00
Torsten Ruger
c36a08d52d small fixes 2014-05-21 19:33:58 +03:00
Torsten Ruger
b281c24a39 move towards locals (not hardcoding registers) 2014-05-21 19:27:27 +03:00
Torsten Ruger
570b6db659 start using locals 2014-05-21 19:06:21 +03:00
Torsten Ruger
847a486288 fix from assign 2014-05-21 19:06:06 +03:00
Torsten Ruger
c701eb9f5b outputting hex for better comparison with objdump 2014-05-21 19:04:48 +03:00
Torsten Ruger
127ce5a5d9 outputting entries to get jumps rights 2014-05-21 19:04:16 +03:00
Torsten Ruger
2df2dcc528 function now returns locals, not free registers 2014-05-21 16:42:36 +03:00
Torsten Ruger
e1f889fd10 fix fibo with new syntax. certainly works for operators, but not everything 2014-05-21 12:47:40 +03:00
Torsten Ruger
16a07d5aa2 fixed method_missing to check whether local var exists (not gobble everything up) 2014-05-21 12:44:36 +03:00
Torsten Ruger
53cfeb72a4 fix test and remove hack for - 2014-05-21 12:42:54 +03:00
Torsten Ruger
9d873d3cba implement string loading and convert hello test 2014-05-20 19:21:29 +03:00
Torsten Ruger
c7a2ce5af9 phase 2, add/sub instructions work with +- operator 2014-05-20 11:54:59 +03:00
Torsten Ruger
c3c6928dc8 phase one, assignment for constants (moves) work 2014-05-20 11:14:18 +03:00
Torsten Ruger
7056f6f05c first step of assignment magic 2014-05-20 11:03:18 +03:00
Torsten Ruger
fcf76eed34 better testing for small assembly (for coming changes) 2014-05-20 10:29:08 +03:00
Torsten Ruger
0fa47d204e minor 2014-05-20 10:28:34 +03:00
Torsten Ruger
f34fddd383 minor 2014-05-19 21:28:18 +03:00
Torsten Ruger
fe1414f383 adds hand coded fibo, works 2014-05-19 17:32:41 +03:00
Torsten Ruger
285988f173 putint works, work on syntax goes on 2014-05-19 15:44:12 +03:00
Torsten Ruger
76ce9aa654 improve argument handling for puntint 2014-05-19 12:18:01 +03:00
Torsten Ruger
8ba79d8de8 fibinacci actually compiles, doesnt mean it works though 2014-05-19 11:29:18 +03:00
Torsten Ruger
c56b7cdf09 minor 2014-05-19 11:28:37 +03:00
Torsten Ruger
59952f8503 more work on instruction format 2014-05-19 11:28:13 +03:00
Torsten Ruger
76f1537174 fix some arguemnt names 2014-05-18 12:34:53 +03:00
Torsten Ruger
9fc8bfbb55 fixin up mov arguments 2014-05-18 12:30:49 +03:00
Torsten Ruger
2be96dccdc fix logic instruction arguments 2014-05-18 12:18:57 +03:00
Torsten Ruger
6abd10f278 started naming instruction arguments properly, starting with compare 2014-05-18 11:11:26 +03:00
Torsten Ruger
f65ad813af move first arg into derived intruction constructor 2014-05-18 10:27:35 +03:00
Torsten Ruger
a35bba39bc merge logichelper into last class that uses it 2014-05-18 10:24:14 +03:00
Torsten Ruger
7b1b2c5d87 aliased add_code to <<, to give a bit of the stream feel 2014-05-18 10:15:43 +03:00
Torsten Ruger
53666e8b33 bit of evaling 2014-05-16 23:33:25 +03:00
Torsten Ruger
a08661955f a bit of cleanup and the good news is, we can output a (small) number 2014-05-16 23:24:19 +03:00
Torsten Ruger
fee82643e5 strangely the coredumps stopped. sure didnt feel like they would 2014-05-16 23:08:45 +03:00
Torsten Ruger
7e2210f772 renaming update_status_flag to just update_status 2014-05-16 19:56:13 +03:00
Torsten Ruger
b3f7b66ceb coding the weird udiv10 and utoa 2014-05-16 19:55:46 +03:00
Torsten Ruger
823c11a381 more work on instrucitons, mov this time 2014-05-16 17:31:01 +03:00
Torsten Ruger
4030f32ead finally coded the logic Shifting (what a beast) 2014-05-16 12:55:51 +03:00
Torsten Ruger
87e0f297e3 rename extra to right in logic inst 2014-05-16 11:27:30 +03:00
Torsten Ruger
ccafb09224 rename first hash argument from right to left in logic inst 2014-05-16 10:54:56 +03:00
Torsten Ruger
ef17bbf9dd rename left to first in instruction and started on logic instruction cleanup 2014-05-16 10:42:25 +03:00
Torsten Ruger
009c0895f4 change right syntax to 1.9 style, looks a little nicer 2014-05-15 21:35:45 +03:00
Torsten Ruger
a0f0d08e81 named the first intruction constructor argument 2014-05-15 19:41:51 +03:00
Torsten Ruger
b4c79d218f work on Integer.to_s , not a simple task as it turns out 2014-05-15 16:54:23 +03:00
Torsten Ruger
c9ffb78e82 allowing comments instead of newlines and not capturing comments (leave that for later as it messes the output) 2014-05-14 22:19:20 +03:00
Torsten Ruger
3912e0cd31 fix register issues, some typos 2014-05-14 22:04:03 +03:00
Torsten Ruger
e10f4863ee exporting labels to elf for (a lot) better readability 2014-05-14 16:15:47 +03:00
Torsten Ruger
d8d536aa2c while assembles, now for some nice assmbler reading 2014-05-14 12:54:23 +03:00
Torsten Ruger
a5b4f3d9ad remove NumLiteral, replace with IntegerConstant 2014-05-14 12:08:06 +03:00
Torsten Ruger
d6b5d46165 while compiles. jo 2014-05-14 12:02:54 +03:00
Torsten Ruger
d50c38f5ad add more functionality to get while to work (not there yet) 2014-05-14 11:33:23 +03:00
Torsten Ruger
2230a4f25e clean up intruction instantiation and fix tests 2014-05-14 10:47:30 +03:00
Torsten Ruger
46ea1df51e rename function_call to call_site in all levels to avoid confusion 2014-05-13 21:15:02 +03:00
Torsten Ruger
04af367bc0 coming together, more and more each day 2014-05-13 21:06:12 +03:00
Torsten Ruger
f6711ea49c checkpointing on the mad road to register allocation 2014-05-13 18:21:24 +03:00
Torsten Ruger
b0302948dd rename machine to c_machine 2014-05-13 17:06:42 +03:00
Torsten Ruger
d7f31e7f39 introduce constant class and add block to compile signature(wip, work in progress) 2014-05-13 16:24:19 +03:00
Torsten Ruger
dd05b30230 ads to_s to ast for better readability 2014-05-13 10:49:26 +03:00
Torsten Ruger
cd67589f3e life must go on, compunds must go (for now) 2014-05-13 08:35:49 +03:00
Torsten Ruger
72de0089b2 small renames 2014-05-13 08:24:55 +03:00
Torsten Ruger
ff612446be using hash_key and value rules 2014-05-12 21:44:51 +03:00
Torsten Ruger
fdb5dd4f67 a good stab at array anf hash constants 2014-05-12 21:36:38 +03:00
Torsten Ruger
25a7c3ea68 fixed fibonacci example 2014-05-12 14:24:36 +03:00
Torsten Ruger
1170b0798b make condition brackets optional 2014-05-12 13:57:24 +03:00
Torsten Ruger
956d1eb135 newline fiddling in the parser yields goods results 2014-05-12 13:47:47 +03:00
Torsten Ruger
ee4d8033af redid while with brackets and just one condition expression 2014-05-12 12:26:38 +03:00
Torsten Ruger
e2fb0a5f34 rename conditional to control in parser 2014-05-12 12:20:31 +03:00
Torsten Ruger
7940efc64d still trying that while loop. Check as everything else works 2014-05-12 12:14:04 +03:00
Torsten Ruger
cc5915135a add lots of operators. Assignment becomes operator. fix the mess 2014-05-11 18:37:26 +03:00
Torsten Ruger
b4af123c9e operator docs 2014-05-11 17:05:21 +03:00
Torsten Ruger
be4825579d finally remove kaspers example from which the oprerator stuff is copied 2014-05-10 21:43:03 +03:00
Torsten Ruger
2d389d2e00 adds basic math operators, thanks to kasper associative and prioritised 2014-05-10 21:41:46 +03:00
Torsten Ruger
6378209f33 leave assignee as name_expression in assignment, fix tests accordingly 2014-05-10 19:11:32 +03:00
Torsten Ruger
47f1608685 start to add while loop 2014-05-10 19:02:51 +03:00
Torsten Ruger
e600911fe8 adds variable, something compliles , but... 2014-05-10 17:55:02 +03:00
Torsten Ruger
5b002c0ff6 little more attribute filing 2014-05-10 16:08:53 +03:00
Torsten Ruger
9e5b60dfab moving many attributes into the attributes hash, but not nearly all 2014-05-10 15:59:46 +03:00
Torsten Ruger
8faf0ba17f phase 1- get rid of the pesty args in structions 2014-05-10 15:47:27 +03:00
Torsten Ruger
3f88fe15b4 some reagganging on my way to retire logic_helper 2014-05-10 15:34:05 +03:00
Torsten Ruger
cba171cc7d remove the old asm (that is now arm) 2014-05-10 15:27:10 +03:00
Torsten Ruger
79a28ac5fa trying to get function calls to work (but will have to rework regeister handling) 2014-05-10 15:24:56 +03:00
Torsten Ruger
e69decee90 slight shuffling 2014-05-10 12:54:31 +03:00
Torsten Ruger
20128627c7 implements inspect for copy paste into tests 2014-05-10 12:54:10 +03:00
Torsten Ruger
051b0ea7dc remove the double transform rules (as not using maybe anymore) 2014-05-10 12:02:11 +03:00
Torsten Ruger
8f2a22d12f add a repeat to the root parser rule (need to test the root more) 2014-05-10 11:18:39 +03:00
Torsten Ruger
b266bb84ba splitting the parser up more 2014-05-10 11:14:34 +03:00
Torsten Ruger
af1df1a104 renamed root parser class to Crystal 2014-05-10 11:03:23 +03:00
Torsten Ruger
31aa9c8768 actually ads a value to Value 2014-05-10 10:59:56 +03:00
Torsten Ruger
7341586d15 more expressions compile 2014-05-10 10:58:25 +03:00
Torsten Ruger
8e6297dcff improving the string according to kasper 2014-05-09 13:51:47 +03:00
Torsten Ruger
6ee290e0bb fixes all existing parser tests 2014-05-08 21:09:07 +03:00
Torsten Ruger
53a8efaa59 get the conditionals to work again 2014-05-08 19:49:15 +03:00
Torsten Ruger
b82c2241b7 get parameter lists to work again (no more ifs as function arguments:-) 2014-05-08 19:41:27 +03:00
Torsten Ruger
9c609ee299 make machine init default to the running one with ruby config 2014-05-08 19:30:46 +03:00
Torsten Ruger
9c2dfe79da at least basic tests work again 2014-05-08 18:42:24 +03:00
Torsten Ruger
034ae4f7ca add comment and remove newline from space (starting a long whitespace battle) 2014-05-08 18:38:49 +03:00
Torsten Ruger
f0ad11bf8c resistance was useless, wilson is now part of the collective (as intel) 2014-05-08 15:09:56 +03:00
Torsten Ruger
f7f0eee31a adjust program tests to new syntax, hello world works there too -) 2014-05-08 14:14:15 +03:00
Torsten Ruger
ee864fc602 fixed arm tests to use ArmMachine 2014-05-07 14:58:38 +03:00
Torsten Ruger
4135c4d2dc crystal says Hello. 2014-05-06 21:36:28 +03:00
Torsten Ruger
fa123e0354 move kernel to core and apply the classmethod pattern to all core classes 2014-05-06 12:47:07 +03:00
Torsten Ruger
12b6800efe work on function entry and exit. fix stack instructions 2014-05-06 12:42:43 +03:00
Torsten Ruger
22b5117c8b getting a _start and _exit, just missing the actual code 2014-05-06 00:12:04 +03:00
Torsten Ruger
7d20b5e2df at least its in shape to start debugging again (that must count as half full) 2014-05-05 22:21:11 +03:00
Torsten Ruger
69b04d930f cleanup 2014-05-05 15:59:29 +03:00
Torsten Ruger
de66238a9e moved all compile to ast, vm does link and assemble. Getting there 2014-05-05 11:03:43 +03:00
Torsten Ruger
99da6f5be3 gets rid of conversion approach, ast compiles 2014-05-05 10:13:49 +03:00
Torsten Ruger
c67ee7f6f3 extracted ast classes to own files 2014-05-05 10:02:02 +03:00
Torsten Ruger
7c7e58ea62 upgrades ast to first class 2014-05-05 09:51:16 +03:00
Torsten Ruger
7c0aa8ae7d getting better, but somethings off 2014-05-05 09:35:40 +03:00
Torsten Ruger
a61170942f so close i can smell it, checkpoint 2014-05-03 22:18:04 +03:00
Torsten Ruger
968556a03e get the tests to work 2014-05-03 18:56:56 +03:00
Torsten Ruger
04e4dc872e check 2014-05-03 18:51:47 +03:00
Torsten Ruger
845a8cab8b more semi random code, a checkpoint 2014-05-03 15:13:44 +03:00
Torsten Ruger
1c86ecb84e copied asm here so that stays working while i break (an) arm 2014-05-03 15:13:15 +03:00
Torsten Ruger
fae0c1ab8c renamed program to assembler (to avoid clashes in vm) 2014-05-02 08:14:38 +03:00
Torsten Ruger
990b4726ba more random code 2014-05-02 08:02:25 +03:00
Torsten Ruger
90e2658bc0 small poslish 2014-04-29 16:22:12 +03:00
Torsten Ruger
7dfde45373 fixes missing string tests and expression/transformation 2014-04-29 11:17:19 +03:00
Torsten Ruger
874f080ba2 Semi random code for the next step 2014-04-28 22:08:09 +03:00
Torsten Ruger
129f9f5c57 space and order fiddling (gets assignments to work better) 2014-04-28 22:07:13 +03:00
Torsten Ruger
92a9372dcc moved nodes to parser (one more layer) and fixed tests. also adds assignment 2014-04-28 21:21:12 +03:00
Torsten Ruger
cfcb9ded2f fixed and tightened transformation tests, also by implementing node == 2014-04-28 16:07:34 +03:00
Torsten Ruger
e04973fc3c making grammar look more like ruby 2014-04-28 15:46:57 +03:00
Torsten Ruger
18c2abfd2b some docs 2014-04-27 21:51:06 +03:00
Torsten Ruger
74060d6ab6 expanded many rule names, added some tests to find the bugs introduced 2014-04-27 21:41:38 +03:00
Torsten Ruger
408cf98ea5 renamed parser rules for clarity. fixed 2014-04-27 21:12:42 +03:00
Torsten Ruger
583e6f0c9f add keyword and operators as seperate parser modules 2014-04-27 21:12:24 +03:00
Torsten Ruger
28410ab22a adjusted code and tests to use renamed and rearranged parser bits 2014-04-27 18:13:34 +03:00
Torsten Ruger
032758db8b using new modules 2014-04-27 18:13:10 +03:00
Torsten Ruger
d8f228da11 more basic types (untested) 2014-04-27 18:12:32 +03:00
Torsten Ruger
4e4099e552 adds tokens as own parser module 2014-04-27 18:12:04 +03:00
Torsten Ruger
f628c67188 starting to deompose the parser 2014-04-27 16:30:32 +03:00
Torsten Ruger
d72c9a3bb0 fixed tests (namespacing) and finally created a test_all 2014-04-27 15:44:34 +03:00
Torsten Ruger
436a5dac5a created own directory for parser 2014-04-27 15:38:07 +03:00
Torsten Ruger
b1203363d4 vendored parslet, deemed stable enough and better without dependency 2014-04-27 15:34:35 +03:00
Torsten Ruger
6fafeda66d block dsl facelift 2014-04-27 15:19:48 +03:00
Torsten Ruger
88ed97ac3b fix the tests with new block syntax 2014-04-25 21:08:19 +03:00
Torsten Ruger
92beb638de better logic with new block class 2014-04-25 18:37:19 +03:00
Torsten Ruger
7af46d210b rename label to block and assembler to program 2014-04-25 18:36:40 +03:00
Torsten Ruger
75873ea18e cleaned intruction initialization and fixed a test accidentally (was schoddy code) 2014-04-25 15:07:47 +03:00
Torsten Ruger
eca9e66f73 renamed instruciton tools to arm machine 2014-04-25 13:34:10 +03:00
Torsten Ruger
f1a7993b47 bit of renaming , cleaning and documentation 2014-04-25 13:29:12 +03:00
Torsten Ruger
6261451c4b adds code class as base for anything that can be assembled 2014-04-25 12:28:23 +03:00
Torsten Ruger
d08e6702f0 removes the asm from assemble signature (not used) 2014-04-25 11:56:53 +03:00
Torsten Ruger
3f316cda63 fixed root 2014-04-24 21:02:27 +03:00
Torsten Ruger
f39eef38a1 complier was deemed redundant, as the java stuff 2014-04-24 21:02:00 +03:00
Torsten Ruger
2b1a56b4fe starting with own node tests 2014-04-24 19:45:22 +03:00
Torsten Ruger
c411ac5df8 removed the structs (code smell) 2014-04-24 17:38:06 +03:00
Torsten Ruger
305f2380a9 folded fake builder, started adapting tests and added example file 2014-04-24 17:17:17 +03:00
Torsten Ruger
601dc22b2e get thnads tests to work 2014-04-24 15:53:48 +03:00
Torsten Ruger
d90ea3dd26 copied thnad to get a kickstart 2014-04-24 15:43:20 +03:00
Torsten Ruger
f97205300f cleaned up BIG time, instruction hierachy, better names, DRYd up a lot 2014-04-23 23:40:35 +03:00
Torsten Ruger
c98547137b first step to overloading assemble 2014-04-23 19:59:55 +03:00
Torsten Ruger
b2f45d9f9c move a function out of the builder to tools for clarity 2014-04-23 14:02:58 +03:00
Torsten Ruger
ced82628d4 forgot a puts 2014-04-23 14:02:39 +03:00
Torsten Ruger
7d1be1f908 improved requires 2014-04-23 13:57:34 +03:00
Torsten Ruger
69c1f8fccc reduced label mess 2014-04-23 13:52:34 +03:00
Torsten Ruger
bc60e1d265 actually remoe the unused relocation stuff 2014-04-23 13:11:48 +03:00
Torsten Ruger
89a92f80c9 merged arm_assembler and assmbler (who are we kidding, right) 2014-04-23 13:02:02 +03:00
Torsten Ruger
f4299de120 finally cleaned up those pestey parse errors 2014-04-23 12:58:59 +03:00
Torsten Ruger
ceefa05b2f removed arm subdirectory 2014-04-23 12:51:09 +03:00
Torsten Ruger
1423b8a845 renove Node class as it wasnt doing anything 2014-04-23 12:38:38 +03:00
Torsten Ruger
8955cf31da really remove externs 2014-04-23 11:14:25 +03:00
Torsten Ruger
dc9bba58e2 move unused addr table out of the way 2014-04-23 11:09:38 +03:00
Torsten Ruger
778890298c rename data_object to string_node and move the padding there 2014-04-23 00:12:43 +03:00
Torsten Ruger
b240dc5100 fixing address resolution cleans up hello world 2014-04-22 23:55:47 +03:00
Torsten Ruger
7ff8fa8802 a little renaming and moving around of constants 2014-04-22 23:35:15 +03:00
Torsten Ruger
1dedc41e39 rename objects to value sin assembler 2014-04-22 22:24:22 +03:00
Torsten Ruger
e23211602b Hello World 2014-04-22 14:39:47 +03:00
Torsten Ruger
5127deeeff implement offset addressing for load (ie reg+num) 2014-04-22 12:23:55 +03:00
Torsten Ruger
2784a8da98 just use register nodes as registers (no more arrays) 2014-04-22 11:58:17 +03:00
Torsten Ruger
40a6437893 most the relocation stuff is going 2014-04-21 21:38:39 +03:00
Torsten Ruger
f724883691 adds position to instruction 2014-04-21 21:21:45 +03:00
Torsten Ruger
fc81122bc4 renamed code generator to arm assembler (more appropriate) 2014-04-21 21:13:14 +03:00
Torsten Ruger
7478b65fb0 dropped extern functionality for now 2014-04-21 21:02:11 +03:00
Torsten Ruger
5237ff9e40 move towards simpler relocation model 2014-04-21 20:59:48 +03:00
Torsten Ruger
1b8f15a3fc rename write to assembler for builders 2014-04-21 20:51:13 +03:00
Torsten Ruger
82ea5730f3 math node went too, more clarity 2014-04-21 17:39:10 +03:00
Torsten Ruger
c87967c95d removes ArgNode which just served to make long names (unused) 2014-04-21 17:35:38 +03:00
Torsten Ruger
fc3f5d5402 remove some of the node mess 2014-04-21 17:34:24 +03:00
Torsten Ruger
ff38bde44e clean and work on labels 2014-04-21 17:27:05 +03:00
Torsten Ruger
49ee2af8af slightly better name for builder 2014-04-21 00:28:26 +03:00
Torsten Ruger
98a197a0ca better builder names and remove the funny make syntax 2014-04-21 00:07:33 +03:00
Torsten Ruger
2dffad61b8 fix cp paste 2014-04-21 00:07:03 +03:00
Torsten Ruger
2c57ca773b push and pop were forgotten, fixed and tested 2014-04-20 23:48:04 +03:00
Torsten Ruger
6226521abb figuring relocations 2014-04-20 02:28:57 +03:00
Torsten Ruger
4e075e3a81 ast was used in parsing 2014-04-20 02:28:15 +03:00
Torsten Ruger
091a93f368 fix names and requires to get some elf out again (still crashes though) 2014-04-19 23:25:46 +03:00
Torsten Ruger
bef1df8485 test and fix store instruction (syntax was not for coding) 2014-04-19 19:34:04 +03:00
Torsten Ruger
4bb74a0de2 fix block initialization style by adding init methods 2014-04-18 19:19:57 +03:00
Torsten Ruger
529f109171 found and fixed a real bug 2014-04-18 16:04:14 +03:00
Torsten Ruger
4fa00371e5 remove lines and columns 2014-04-18 15:58:42 +03:00
Torsten Ruger
5d9c4323bb test no 3 2014-04-17 15:35:55 +03:00
Torsten Ruger
f38c94d8e9 add accessor for the s instruction postfix (affecting status flag) 2014-04-17 12:54:37 +03:00
Torsten Ruger
a7af1a4664 small doc 2014-04-16 12:45:36 +03:00
Torsten Ruger
8e0494f410 move some unused parse related classes out of the way 2014-04-16 12:10:58 +03:00
Torsten Ruger
69b0f7a0e3 lift the nodes out of the parser 2014-04-16 12:03:39 +03:00
Torsten Ruger
5bd4be313c lift label out of the code generator 2014-04-16 12:02:28 +03:00
Torsten Ruger
2e6b90b12e cleanup, requires, namespacing to actually get it to work 2014-04-14 21:52:16 +03:00
Torsten Ruger
408b290b8a adds first version of the expanded as assembler from mikko 2014-04-14 18:09:56 +03:00
Torsten Ruger
8648647754 jeweler generates its things 2014-04-14 15:58:59 +03:00