smbAlpha= abcdefghijklmnopqrstuvwxyz raquo ;; chkSymbolIds= Less Greater Equal Plus Minus Star Slash Hat Percent raquo ;; smbSymbol= lt; gt;=+ - */^% raquo ;; nExtraSymbolNumber=14; smbNBSP;
//Підтримка безлічі состоянійchkStateIds= Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10 Q11 Q12 Q13 Q14 Q15 Q16 Q17 Q18 Q19 raquo ;; stState=[ q1 raquo ;, q2 raquo ;, q3 raquo ;, q4 raquo ;, q5 raquo ;, q6 raquo ;, q7 raquo ;, q8 raquo ;, q9 , laquo ;, q11 laquo ;, q12 laquo ;, q13 laquo ;, q14 laquo ;, q15 laquo ;, q16 laquo ;, q17 laquo ;, q18 laquo ;, q19 ]; cellWidth=30; nExtraStateNumber=10; arTMTape=[]; tapeShift=100 ; setTMProgram; setTMAlphabet; setTMStates; strTMCurrentState; idxTMCurrentCell; init () {= document.getElementById ( tape );=document.getElementById ( program );=document.getElementById ( errorType );=document.getElementById ( errorMessage );=document.getElementById ( config );=document.getElementById ( state );=document.getElementById ( newState );=document.getElementById ( speed laquo ;);=document.getElementById ( ctlNextCommand );=document.getElementById ( ctlTapeContainer );=document.getElementById ( ctlNBSP" ). firstChild.nodeValue; (var i=-tapeShift; i lt; tapeShift; i ++) {(i);
} ();
} createCell (n) {
//var cell=document.createElement ( div ); cell=document.createElement ( td ); input=document.createElement ( input ) ;. setAttribute ( type raquo ;, text ) ;. setAttribute ( size raquo ;, 1) ;. appendChild (input) ;. setAttribute ( tabindex raquo ;, 1 );=ctlTape.appendChild (cell);.firstChild.readOnly=true; .tabIndex=1; .tapeIndex=n; .onclick=function () {ctlTape_click (this.tapeIndex); };
//cell.setAttribute ( style raquo ;, left: + (30 * (n + tapeShift)) + px ); cell;
} tmFocusCell (n) {(! isNaN (idxTMCurrentCell)) {cell=ctlTapeildNodes [idxTMCurrentCell + tapeShift] ;. className=cell.className.replace (/ focused /, )
. replace (/ s +/g, ). replace (/ ^ s + /, ). replace (/ s + $ /, ) ;
} cell=ctlTapeildNodes [n + tapeShift] ;. className= focused + (Cell.className? Laquo; + cell.className: );=n; .firstChild.focus ();
//if (ctlTapeContainer.doScroll) {
//var th=Math.floor (600/(tapeShift * 2) * (n + tapeShift));
//window.setTimeout (function () {
//while (th -)
//ctlTapeContainer.doScroll ( scrollbarRight );
//}, 50);
//// alert (100/(tapeShift * 2) * (n + tapeShift));
//}
} tmSetCellValue (n, v) {(v == B )= raquo ;; [n + tapeShift]=v; cell=ctlTapeildNodes [n + tapeShift];
//while (cellildNodes.length)
//cell.removeChild (cell.lastChild);
//var txt=document.createTextNode (v || smbNBSP);
//cell.appendChild (txt) ;. className=cell.className.replace (/ blankSymbol /, )
. replace (/ s +/g, ). replace (/ ^ s + /, ). replace (/ s + $ /, ) ; (v == ). className= blankSymbol + (Cell.className? Laquo; + cell.className: ) ;. firstChild.value=v;
} tmGetCellValue (n) {v=arTMTape [n + tapeShift]; v == ? B :V;
} tmClearErrors () {(ctlErrorTypeildNodes.length).removeChild(ctlErrorType.lastChild);(ctlErrorMessageildNodes.length).removeChild(ctlErrorMessage.lastChild);
} tmCompileError (strType, b, e) {(ctlProgram.setSelectionRange amp; amp; typeof (ctlProgram.setSelectionRange) == function amp; amp; b lt;=e) {. select () ;. setSelectionRange (b, e);
} (); errT=document.createTextNode (strType) ;. appendChild (errT); strMessage=ctlProgram.value.substring (b, e); errM=document.createTextNode (strMessage) ;. appendChild (errM); (strType);
} tmCompile (text) {(); nextE (bb) {ee=text.substring (bb, text.length) .indexOf ( n ); ee == - 1? text.length: bb + ee;
} arNewProgram={}; (var idxLine=1, b=0, e=nextE (b); b lt; text.length; b=e + 1, e=nextE (b) , idxLine ++) {line=text.substring (b, e);=line.replace (///.*$/, );=line + raquo ;;
//var arMatch=line.match(/^s*(?:([^s][a-zA-Z0-9][a-zA-GI-KM-QS-Z0-9_^*]*-gt;[^s][a-zA-Z0-9][a-zA-GI-KM-QS-Z0-9_^*]*[LRH]?)s+)*$/);arMatch =line.match(/^s*(?:([^s][a-zA-Z0-9](?:[^s-gt;]*[^s-gt;LRH])*-gt;[^s][a-zA-Z0-9](?:[^s-gt;]*[^s-gt;LRH])*[LRH]?)s+)*$/);(!arMatch)tmCompileError(laquo;Синтаксическая помилка в + IdxLine + -му рядку raquo ;, b, e); (var idxCmd=1; idxCmd lt; arMatch.length; idxCmd ++) {strCmd=arMatch [idxCmd]; (! St...