Rem Project: parser
Rem Created: 03/06/2005 17:24:34
 
Rem ***** Main Source File *****
 
`set number of stored words as an array
numberofwords=5
dim word$(numberofwords)
 
`read the words from the word bank into the array
for n=1 to numberofwords
  read word$(n)
next n
 
do
 
`ask for user input
input input$
 
`reset number of words recognised to 0
wordsrecognised=0
 
`repeat for all stored words
for n=1 to numberofwords
 
  `get length of input and length of stored word
  lengthofinput=len(input$)
  lengthofword=len(word$(n))
 
  `check the characters in the input in blocks equal to word length,
  `starting from the left and scrolling one character at a time to the
  `right.
  for character=lengthofword to lengthofinput
    test$=right$(left$(input$,character),lengthofword)
    `check against stored word, and notify if it's the same
    if test$=word$(n)
      print "I recognised the word ",test$
      `add to the number of words recognised
      inc wordsrecognised
      `if a word is found, stop checking for that word and move
      `onto the next one.
      exit
    endif
  next character
 
next n
 
`notify if no words recognised
if wordsrecognised=0
  print "Not recognised"
endif
 
loop
 
`word bank
data "hello","how","are","you","today"