Presentation is loading. Please wait.

Presentation is loading. Please wait.

# Author: David Foltz # # Notice: Orginal Code Idea for program taken from Python v3.2.2 Documentation def Fibonacci(): """Print a Fibonacci series with.

Similar presentations


Presentation on theme: "# Author: David Foltz # # Notice: Orginal Code Idea for program taken from Python v3.2.2 Documentation def Fibonacci(): """Print a Fibonacci series with."— Presentation transcript:

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


Download ppt "# Author: David Foltz # # Notice: Orginal Code Idea for program taken from Python v3.2.2 Documentation def Fibonacci(): """Print a Fibonacci series with."

Similar presentations


Ads by Google