about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-08-08 23:28:58 -0700
committerKartik Agaram <vc@akkartik.com>2018-08-08 23:28:58 -0700
commit5852bb94373c7b8dddd7c4b0b5a105b2d769d4ac (patch)
tree9cd12c2cd3109350de871813869b37f3e0e56f07
parentf02ca8df04281d34b3fce035e0a501f28841982f (diff)
downloadmu-5852bb94373c7b8dddd7c4b0b5a105b2d769d4ac.tar.gz
4497
-rw-r--r--subx/035labels.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/subx/035labels.cc b/subx/035labels.cc
index b3638c8b..957fa5a0 100644
--- a/subx/035labels.cc
+++ b/subx/035labels.cc
@@ -1,6 +1,20 @@
 //: Labels are defined by ending names with a ':'. This layer will compute
 //: addresses for labels, and compute the offset for instructions using them.
 
+//: We're introducing non-number names for the first time, so it's worth
+//: laying down some ground rules all transforms will follow, so things don't
+//: get too confusing:
+//:   - if it starts with a digit, it's treated as a number. If it can't be
+//:     parsed as hex it will raise an error.
+//:   - if it starts with '-' it's treated as a number.
+//:   - if it starts with '0x' it's treated as a number.
+//:   - if it's two characters long, it can't be a name. Either it's a hex
+//:     byte, or it raises an error.
+//: That's it. Names can start with any non-digit that isn't a dash. They can
+//: be a single character long. 'a' is not a hex number, it's a variable.
+//: Later layers may add more conventions partitioning the space of names. But
+//: the above rules will remain inviolate.
+
 :(scenarios transform)
 :(scenario map_label)
 == 0x1