# This is a simple example of the expected TL-Delta Grammar derivative. # This TM takes an input string and replaces all 0's with 1's. # Note: The ~ is the symbol for a space, this may change in the future, # but for now, it was simpler than parsing ' ', because whitespace is # being stripped. Also note that the label names need to adhere to the # C standard, i.e., they must start with an Alpha character and be at # at least one character long and cannot contain special characters # or white space. # pointer(>) means to move the tape head to the right # pointer(<) means to move the tape head to the left # pointer(^) means to leave the tape head in its current position. # scan=0 is a comparison on the symbol where the tape head is currently # and the character 0. # scan:=0 is an assignment, it tells the machine to write a 0 where the # tape head is currently. # ACCEPT tells the machine to accept. # REJECT tells the machine to reject. # either upper or lowercase may be used for keywords. BEGIN L0: IF ( scan=0 ) then begin scan:=1; pointer(>); goto L0; end L1: if ( scan=1 ) then begin scan:=1; pointer(>); goto L0; end L2: if ( scan= ~ ) then begin scan:=~; pointer(>); goto REWIND; end REWIND: if ( scan = 1 ) then begin scan:=1; pointer(<); goto REWIND; end L3: if (scan = ~ ) then begin scan:=~; pointer(>); GOTO FINISH; end FINISH: ACCEPT; END.