Download presentation
Presentation is loading. Please wait.
Published byLenard Howard Modified over 9 years ago
1
# Author: David Foltz # # Notice: Orginal Code Idea for program taken from Python v3.2.2 Documentation def Fibonacci(): """Print a Fibonacci series with an input.""" n = input('How now would you like Fibonacci to go: ') x = int(n) # Converts the String into an Int to be compared. a, b = 0, 1 while a < x: print(a, end=' ') a, b = b, a+b Input file: test program
2
def keyword: def Fibonacci id ( ) : """Print a Fibonacci series with an input.""“ string literal (double) n id = Input keyword: Input ( 'How now would you like Fibonacci to go: ‘ string literal (single?) ) x id = Int ( N ) a, b = 0, 1
3
A..Za..z_ A..Za..z_0_9 def int putin More keywords… 0-9 ‘ Anything but ‘ ‘
4
( ) = +, ++ \t \n ‘ whitespace A tokenizer is just a combination of all DFAs for each type of token that you want to recognize.
5
A..Za..z_ A..Za..z_0_9 def int 0-9 ‘ Anything but ‘ ‘ ( )
6
A..Za..z_ A..Za..z_0_9 def int putin More keywords… 0-9 ‘ Anything but ‘ ‘
7
Keyword table def input int print while A..Za..z_ A..Za..z_0_9 def Keyword: def
8
Keyword table def input int print while A..Za..z_ A..Za..z_0_9 Fibonacci Not a keyword, just an ID
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.