Merge pull request #33 from jszakmeister/fix-bugs-in-tutorial

Fix bugs in tutorial
This commit is contained in:
Siu Kwan Lam 2012-12-17 12:07:21 -08:00
commit d12b145bee
5 changed files with 10 additions and 10 deletions

View file

@ -115,13 +115,13 @@ following simple example computes `Fibonacci
numbers <http://en.wikipedia.org/wiki/Fibonacci_number>`_:
.. code-block:: python
.. code-block:: text
# Compute the x'th fibonacci number.
def fib(x):
if x < 3:
def fib(x)
if x < 3
return 1
else:
else
return fib(x-1)+fib(x-2)
# This expression will compute the 40th number.
@ -226,7 +226,7 @@ the line.
# Regular expressions that tokens and comments of our language.
REGEX_NUMBER = re.compile('[0-9]+(?:.[0-9]+)?')
REGEX_IDENTIFIER = re.compile('[a-zA-Z][a-zA-Z0-9]\ *')
REGEX_IDENTIFIER = re.compile('[a-zA-Z][a-zA-Z0-9]*')
REGEX_COMMENT = re.compile('#.*')

View file

@ -772,7 +772,7 @@ Lexer
# Regular expressions that tokens and comments of our language.
REGEX_NUMBER = re.compile('[0-9]+(?:\.[0-9]+)?')
REGEX_IDENTIFIER = re.compile('[a-zA-Z][a-zA-Z0-9] *')
REGEX_IDENTIFIER = re.compile('[a-zA-Z][a-zA-Z0-9]*')
REGEX_COMMENT = re.compile('#.*')
def Tokenize(string):
@ -811,7 +811,7 @@ Lexer
yield CharacterToken(string[0])
string = string[1:]
yield EOFToken()
yield EOFToken()

View file

@ -1058,7 +1058,7 @@ Main driver code.
'+': 20,
'-': 20,
'*': 40
}
}
# Run the main "interpreter loop".
while True:

View file

@ -847,7 +847,7 @@ Lexer
# Regular expressions that tokens and comments of our language.
REGEX_NUMBER = re.compile('[0-9]+(?:\.[0-9]+)?')
REGEX_IDENTIFIER = re.compile('[a-zA-Z][a-zA-Z0-9] *')
REGEX_IDENTIFIER = re.compile('[a-zA-Z][a-zA-Z0-9]*')
REGEX_COMMENT = re.compile('#.*')
def Tokenize(string):

View file

@ -1000,7 +1000,7 @@ Lexer
# Regular expressions that tokens and comments of our language.
REGEX_NUMBER = re.compile('[0-9]+(?:\.[0-9]+)?')
REGEX_IDENTIFIER = re.compile('[a-zA-Z][a-zA-Z0-9] *')
REGEX_IDENTIFIER = re.compile('[a-zA-Z][a-zA-Z0-9] *')
REGEX_COMMENT = re.compile('#.*')
def Tokenize(string):