rforth1 Notes

From Wiki
Jump to navigationJump to search

Pages

Missing Words

  • ?dup
  • leave
  • ?leave
  • defer

Questions

  • Table read functions exist, but how are tables created?
  • What is eepromc*+ supposed to do? (how can tablec@+ work with EEPROM registers?)
  • No do-loop?
  • Would e, be useful?
  • What about ecreate or eallot?

Modifications

--- rforth.py.org       2009-07-08 15:33:08.735767400 -0400
+++ rforth.py   2009-07-08 15:35:14.110767400 -0400
@@ -688,6 +688,18 @@
 @register('if')
 def run(invert = False):
   name, params = compiler.last_instruction()
+  if name == 'OP_PUSH':
+    value = params[0].static_value()
+    if value == 0:
+      compiler.rewind()
+      compiler.warning('constant 0 will never execute')
+      compiler.eval('ahead')
+    else:
+      compiler.rewind()
+      compiler.warning('constant non-zero will always execute')
+      label = Label()
+      compiler.ct_push(label)
+    return
   if name == 'OP_NORMALIZE':
     compiler.rewind()
     return compiler['if'].run(invert)