# ColorForth inspired source representation (and editor?) # absolutely not worthy of comparison to the original # which is truly a piece of minimalistic art # in colorforth representation each atom is prepended with a # color attribute which determines its semantics: # green: compile # red: define # white: execute # todo: define 2 'interpreters' # an ordinary one (load -> compile to code) # and a special one: display # create dict to contain colorforth extensions dictionary colorforth # switch to it colorforth # interpreter state 0 variable! color 0 constant c-white 1 constant c-red 2 constant c-green # colorforth interpretation & compilation # ColorForth falltrough is not supported # (could be emulated using a stub installed and patched by red) : white? color @ c-white = ; : red c-red color ! : ; # record color and start definition : white-green postpone literal ] ; # compile TOS as literal : green white? if white-green then # white-green transition c-green color ! ; immediate : white white? not if postpone [ then # prev non-white -> enter literal mode c-white color ! read interpret ; immediate # back to parent dictionary parent