Making color work in a language

June 19 Brad Nelson gives an update on his IconForth work at the vsfig meeting.
text/robots/forth/iconForth/notes.txt has some of my notes and the source code for his program when it was presented at the 2009 annual meeting


Most code editors offer 'syntax hi-lighting'.
This hi-lighting can be turned off and the code will still run.
So at most this coloring indicates what role a token has. 
For instance,  reserved words may be given a particular color,
but only a novice will get any benefit from this.

A language,  ColoredScript,  is proposed which is very similar to JavaScript,
but color is a necessary part of the language.
In particular, using color makes you programs more compact:

function Poly(pts,color) {
  var n=pts.length;
  this.pts=pts;
  this.color=color;
}
Poly.prototype=new PointSet();
Poly.prototype.area=function() {  ...  uses this.color ...  return area; }
var poly1=new Poly([[0,0],[1,1],[0,2]],'red');

looks more like:

Poly<[PointSet](pts,color){
  n=pts.length;
  pts=pts;
  color=color;
  area() {  ...  uses color ...  <area; }
}
poly1=Poly([[0,0],[1,1],[0,2]],'red');



What we've done here is gotten rid of 'function', 'var, 'new', class.prototype, 'return', 'class.prototype=new xxx()' by using color.
-------------------------------------

oem:
function name(args) { stmnts }
var name=function(args) { stmnts }
function(args){ stmnts }()
function(){ stmnts }()    // use of a function as a namespace

dom.onclick=function(evt) { ..

//{name:poly,parents:[PointSet],
// locals:[n],properties:[pts,color,area]};

obj
 name // class name
 [protos]             // build an inheritance chain
 [args]
 [locals]             // aka inner or private
 [properties]         // access locals && args as closures
 [classProperties]    // do not access locals || args
 
arrays may be reordered/expanded  also exist as objs so can look up by name the value

coloring for  // coloring indicates the namespace
 function NAME
 this.   // ie a property of this
 local
 arg

abbrev
 return

--- flow
editor .cs w/ jq
keep live conversion to js,  incl any parse errors
when save, also save js
when run, keep a link to library files in their .cs form


obj<[-](-){ ... <T .. }  // basic template of a new fn

http://sites.google.com/site/coloredscript/

http://en.wikipedia.org/wiki/Technicolor#Three-strip_Technicolor  interesting
http://sites.google.com/site/elsamuko/gimp

http://www.youtube.com/watch?v=BAZXKgzWAWs