dalinim / dalim

Dali Backend for Nim language
Other
1 stars 1 forks source link

dumb code emitting #1

Closed akavel closed 5 years ago

akavel commented 5 years ago

sample output:

$ compiler/nim dex --skipcfg arithm.nim
DEX: compile project
Statement list: 
nkVarSection
nkVarSection
nkVarSection
----
 nkStmtList
  nkVarSection
   nkIdentDefs
.. const-wide/32 v0, 27
  nkVarSection
   nkIdentDefs
.. const-wide/32 v1, 2
  nkVarSection
   nkIdentDefs
.. mul-int v2, v0, v1
nkEmpty
----
 nkEmpty
STUB: close
Hint: operation successful (4 lines compiled; 0.001 sec total; 516KiB peakmem; Debug Build) [SuccessX]
richard-jansson commented 5 years ago

Lovely! The quick.sh script cuts a minute from compilation time on my machine!! I don't have the nim0 binary though? Which is a bit weird. Added a little if case to the quick.sh script to make it run on my machine, should still work if nim0 is there!

All of this looks really cool!

I'm not sure about the Ident concept, can't really seem to grasp it. In jsgen they are accessing the arithmetic parts by looking for

nkCallKinds* = {nkCall, nkInfix, nkPrefix, nkPostfix,nkCommand, nkCallStrLit, nkHiddenCallConv}

And then if we are dealing with a nkSym there would be a sym.magic that can be mAddI, mSubI...

So the next step would be to interface dali and generate some actual bytecode I take it?