function syntax(code) {
  var dict = core_words();
  code = code.split(new RegExp('(\n| )', 'g'));
  for(var i=0; i<code.length; i++) {
    if(code[i]=='x' || code[i]=='y' || code[i]=='t') {
      code[i]='<font input>'+code[i]+'</font>';
    }
	if(code[i]==':' || code[i]==';') {
	  code[i]='<font definition>'+code[i]+'</font>';
	}
    for(var name in dict) {
      if(code[i]==name) {
        code[i]='<font word>'+name+'</font>';
      }
    }
	if(parseFloat(code[i]) || code[i].toLowerCase()=='pi' || code[i].toLowerCase()=='random' || code[i]=='0' || code[i]=='-0') {
	  code[i]='<font number>'+code[i]+'</font>';
	}
  }
  app = code.join('');
  app = '<pre>' + app + '</pre>';
  var it = doIt('<link rel="stylesheet" href="text.css" type="text/css">\n'+app);
  for(var i=1;i<=5;i++) it = it.replace(new RegExp('\\[(user|definition|input|word|number|comment)\\]([^\\]]*)\\[/\\1\]', 'g'), '<font $1>$2</font>');
  return it;
}

function doIt(str) {
  var from = new RegExp('<font (definition|word|number|comment|input)(=""|)>([^<]*)</font>( |\n)<font \\1(=""|)>([^<]*)</font>', 'g');
  for(var i=0;i<5;i++) str = str.replace(from, '<font $1>$3$4$6</font>');
  return str.split('(').join('<font comment>(').split(')').join(')</font>');
}

function lightProgram(name) {
  var program = return_code(name)[0];
  var light = syntax(program);
  return light;
}