JavaScript EditorFree JavaScript Editor     Ajax Editor 

Main Page
  Previous Section Next Section

Error Handling

A text game must have error handling just as arcade games do. However, most of the error handling is done in the text parsing. There are lexical tests, syntax tests, and semantic tests that all must be performed. Lexical tests are easy since they have to do with string comparisons and vocabulary checks. The syntax and semantic tests are more complex since the game logic must start using language productions and rules to check if the sentence is valid. This is complex and there are usually many special cases that have to be considered. Similarly, when writing a compiler or interpreter, the code starts off clean, but has a lot of kludges in it by its completion. Text games are very similar: You may find yourself doing some lexical testing in the string input function and some syntax checking in the lexical analyzer. However, better to be safe than sorry! So, the more filters, traps, and tests the input parser has, the better!

      Previous Section Next Section

    JavaScript EditorAjax Editor     JavaScript Editor