Removed more extraneous slashes and fixed the formatting on the mandelbrot example in docs.

This commit is contained in:
Maggie Mari 2012-08-19 12:28:55 -05:00
commit ddcf6483d0
6 changed files with 166 additions and 188 deletions

View file

@ -134,7 +134,7 @@ user-defined operator, we need to parse it:
.. code-block:: python
# prototype # ::= id '(' id\* ')' # ::= binary
# prototype # ::= id '(' id* ')' # ::= binary
LETTER number? (id, id) # ::= unary LETTER (id) def
ParsePrototype(self): precedence = None if isinstance(self.current,
IdentifierToken): kind = 'normal' function_name = self.current.name
@ -250,7 +250,7 @@ whenever we define a new binary operator:
... def main(): ... g_binop_precedence['<'] = 10
g_binop_precedence['+'] = 20 g_binop_precedence['-'] = 20
g_binop_precedence['\*'] = 40 ...
g_binop_precedence['*'] = 40 ...
@ -325,7 +325,7 @@ call ParseUnary instead:
.. code-block:: python
# binoprhs ::= (binary_operator unary)\* def
# binoprhs ::= (binary_operator unary)* def
ParseBinOpRHS(self, left, left_precedence): ... # Parse the unary
expression after the binary operator. right = self.ParseUnary() ...
@ -342,7 +342,7 @@ operator code above with:
.. code-block:: python
# prototype # ::= id '(' id\* ')' # ::= binary
# prototype # ::= id '(' id* ')' # ::= binary
LETTER number? (id, id) # ::= unary LETTER (id) def
ParsePrototype(self): precedence = None if isinstance(self.current,
IdentifierToken): ... elif isinstance(self.current, UnaryToken): kind =
@ -497,157 +497,135 @@ Given this, we can try plotting out the mandlebrot set! Lets try it out:
.. code-block:: bash
ready> mandel(-2.3, -1.3, 0.05, 0.07)
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\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\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*++++++++...
++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*+++++++++....
.+++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*+++..+++++....
..+++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
\*\*\*\*\*\*\*\*\*\*\*\*\*\*++++++. ..........
+++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
\*\*\*\*\*\*\*\*\*\*\*++++++++.. ..
.++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
\*\*\*\*\*\*\*\*\*++++++++++...
.++++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\*\*\*\*\*\*\*++++++++++..
.++++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\*\*\*\*\*\*++++++.....
..++++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\*\*\*\*\*\*+........
...++++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\*\*\*\*\*\*+... ....
...++++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\*\*\*\*\*\*+++++......
..++++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\*\*\*\*\*\*++++++++++...
.++++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
\*\*\*\*\*\*\*\*\*++++++++++...
++++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
\*\*\*\*\*\*\*\*\*\*+++++++++.. ..
..++\*\*\*\*\*\*\*\*\*\*\*\*\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*\*\*\*\*+++++++++++++++++++++.......
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*++++++++++++++++++++..........
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*+++++++++++++++++++...
...
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*++++++++++++++++++++......
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*++++++++++++++++++++.......
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*+++++++++++++++++++++..........
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*++++++++++++++++++++++...........
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*++++++++++++++++++++++++.........
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*++++++++...........+++++..............
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*++++++++++++....
.........................
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*+++++++++++++++++.... .........
............ \*\*\*\*\*\*\*\*\*\*\*+++++++++++++++++++++..... ......
\*\*\*\*\*\*\*\*+++++++++++++++++++++++.......
\*\*\*\*\*\*+++++++++++++++++++++++++........
\*\*\*\*+++++++++++++++++++++++++.......
***+++++++++++++++++++++++.........**\ ++++++++++++++++...........*\ ++++++++++++................
\*++++....................
*++++....................*\ ++++++++++++................
**++++++++++++++++...........**\ *+++++++++++++++++++++++.........
\*\*\*\*+++++++++++++++++++++++++.......
\*\*\*\*\*\*+++++++++++++++++++++++++........
\*\*\*\*\*\*\*\*+++++++++++++++++++++++.......
\*\*\*\*\*\*\*\*\*\*\*+++++++++++++++++++++..... ......
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*+++++++++++++++++.... .........
............ \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*++++++++++++....
.........................
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*++++++++...........+++++..............
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*++++++++++++++++++++++++.........
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*++++++++++++++++++++++...........
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*+++++++++++++++++++++..........
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*++++++++++++++++++++.......
Evaluated to: 0.0 ready> mandel(-0.9, -1.4, 0.02, 0.03)
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*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*\*\*\*\*\*\*+++++++++++++++++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*+++++++++++...++++++++++++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*+++++++++++++.. .
.++++++++++++++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*++++++++++++++++...
......++++++++++++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
\*\*\*\*\*\*\*\*\*\*\*\*\*\*+++++++++++++++++++...
.......+++++++++++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
\*\*\*\*\*\*\*\*\*\*\*\*++++++++++++++++++++.... ....
..++++++++++++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
\*\*\*\*\*\*\*\*\*\*++++++++++++++++++++++......
...++++++++++++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
\*\*\*\*\*\*\*\*+++++++++++++++++++++++.......
.....++++++++++++++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
\*\*\*\*\*\*++++++++++++++++++++++++.......
.....+++++++++++++++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
\*\*\*\*+++++++++++++++++++++++++.... .
.....+++++++++++++++\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
**+++++++++++++++++++++++++....
...++++++++++++++++**\ \*\*\*\*\*\*\*\*\*\*\**\ +++++++++++++++++++++++.......
....++++++++++++++++\*\*\*\*\*\*\*\*\*\*\*\*
+++++++++++++++++++++..........
.....++++++++++++++++\*\*\*\*\*\*\*\*\*\*\*
++++++++++++++++++.............
.......+++++++++++++++\*\*\*\*\*\*\*\*\*\*
+++++++++++++++................
............++++++++++\*\*\*\*\*\*\*\*\*\*
+++++++++++++................. .................+++++\*\*\*\*\*\*\*\*\*
+++++++++++... .... .......... .+++++\*\*\*\*\*\*\*\* ++++++++++.....
........ ...+++++\*\*\*\*\*\*\* ++++++++...... ..++++++\*\*\*\*\*\*
+++++++........ ..+++++\*\*\*\*\*\* +++++.......... ..++++++\*\*\*\*\*
++++.......... ....++++++\*\*\*\*\* ++.......... ....+++++++\*\*\*\*
.......... ......+++++++\ **\* .......... .....+++++++**\ \* ..........
.....++++++\ **\* ......... .+++++++** ........ .+++++++\ *\* ......
...+++++++* . ....++++++++\* ...++++++++\* ..+++++++++ ..+++++++++
Evaluated to: 0.0 ready> ^C
*******************************************************************************
*******************************************************************************
****************************************++++++*********************************
************************************+++++...++++++*****************************
*********************************++++++++.. ...+++++***************************
*******************************++++++++++.. ..+++++**************************
******************************++++++++++. ..++++++*************************
****************************+++++++++.... ..++++++************************
**************************++++++++....... .....++++***********************
*************************++++++++. . ... .++**********************
***********************++++++++... ++**********************
*********************+++++++++.... .+++*********************
******************+++..+++++.... ..+++********************
**************++++++. .......... +++********************
***********++++++++.. .. .++********************
*********++++++++++... .++++*******************
********++++++++++.. .++++*******************
*******++++++..... ..++++*******************
*******+........ ...++++*******************
*******+... .... ...++++*******************
*******+++++...... ..++++*******************
*******++++++++++... .++++*******************
*********++++++++++... ++++*******************
**********+++++++++.. .. ..++********************
*************++++++.. .......... +++********************
******************+++...+++..... ..+++********************
*********************+++++++++.... ..++*********************
***********************++++++++... +++*********************
*************************+++++++.. . ... .++**********************
**************************++++++++....... ......+++***********************
****************************+++++++++.... ..++++++************************
*****************************++++++++++.. ..++++++*************************
*******************************++++++++++.. ...+++++**************************
*********************************++++++++.. ...+++++***************************
***********************************++++++....+++++*****************************
***************************************++++++++********************************
*******************************************************************************
*******************************************************************************
*******************************************************************************
*******************************************************************************
*******************************************************************************
Evaluated to 0.0
ready> mandel(-2, -1, 0.02, 0.04)
******************************************************************+++++++++++++
****************************************************************+++++++++++++++
*************************************************************++++++++++++++++++
***********************************************************++++++++++++++++++++
********************************************************+++++++++++++++++++++++
******************************************************++++++++++++++++++++++...
***************************************************+++++++++++++++++++++.......
*************************************************++++++++++++++++++++..........
***********************************************+++++++++++++++++++... ...
********************************************++++++++++++++++++++......
******************************************++++++++++++++++++++.......
***************************************+++++++++++++++++++++..........
************************************++++++++++++++++++++++...........
********************************++++++++++++++++++++++++.........
***************************++++++++...........+++++..............
*********************++++++++++++.... .........................
***************+++++++++++++++++.... ......... ............
***********+++++++++++++++++++++..... ......
********+++++++++++++++++++++++.......
******+++++++++++++++++++++++++........
****+++++++++++++++++++++++++.......
***+++++++++++++++++++++++.........
**++++++++++++++++...........
*++++++++++++................
*++++....................
*++++....................
*++++++++++++................
**++++++++++++++++...........
***+++++++++++++++++++++++.........
****+++++++++++++++++++++++++.......
******+++++++++++++++++++++++++........
********+++++++++++++++++++++++.......
***********+++++++++++++++++++++..... ......
***************+++++++++++++++++.... ......... ............
*********************++++++++++++.... .........................
***************************++++++++...........+++++..............
********************************++++++++++++++++++++++++.........
************************************++++++++++++++++++++++...........
***************************************+++++++++++++++++++++..........
******************************************++++++++++++++++++++.......
Evaluated to: 0.0
ready> mandel(-0.9, -1.4, 0.02, 0.03)
*******************************************************************************
*******************************************************************************
*******************************************************************************
*******************************************************************************
*******************************************************************************
*******************************************************************************
*******************************************************************************
*******************************************************************************
****************************+++++++++++++++++**********************************
***********************+++++++++++...++++++++++++******************************
********************+++++++++++++.. . .++++++++++++++**************************
*****************++++++++++++++++... ......++++++++++++************************
**************+++++++++++++++++++... .......+++++++++++**********************
************++++++++++++++++++++.... .... ..++++++++++++********************
**********++++++++++++++++++++++...... ...++++++++++++*******************
********+++++++++++++++++++++++....... .....++++++++++++++*****************
******++++++++++++++++++++++++....... .....+++++++++++++++****************
****+++++++++++++++++++++++++.... . .....+++++++++++++++***************
**+++++++++++++++++++++++++.... ...++++++++++++++++*************
*+++++++++++++++++++++++....... ....++++++++++++++++************
+++++++++++++++++++++.......... .....++++++++++++++++***********
++++++++++++++++++............. .......+++++++++++++++**********
+++++++++++++++................ ............++++++++++**********
+++++++++++++................. .................+++++*********
+++++++++++... .... .......... .+++++********
++++++++++..... ........ ...+++++*******
++++++++...... ..++++++******
+++++++........ ..+++++******
+++++.......... ..++++++*****
++++.......... ....++++++*****
++.......... ....+++++++****
.......... ......+++++++***
.......... .....+++++++***
.......... .....++++++***
......... .+++++++**
........ .+++++++**
...... ...+++++++*
. ....++++++++*
...++++++++*
..+++++++++
..+++++++++
Evaluated to: 0.0
ready> ^C
@ -1007,7 +985,7 @@ the if/then/else and for expressions:
def GetOperatorName(self): assert self.is_operator return self.name[-1]
def CodeGen(self): # Make the function type, eg. double(double,double).
funct_type = Type.function( Type.double(), [Type.double()] \*
funct_type = Type.function( Type.double(), [Type.double()] *
len(self.args), False)
::
@ -1095,7 +1073,7 @@ the if/then/else and for expressions:
isinstance(self.current, CharacterToken): return
g_binop_precedence.get(self.current.char, -1) else: return -1
# identifierexpr ::= identifier | identifier '(' expression\* ')' def
# identifierexpr ::= identifier | identifier '(' expression* ')' def
ParseIdentifierExpr(self): identifier_name = self.current.name
self.Next() # eat identifier.
@ -1217,7 +1195,7 @@ the if/then/else and for expressions:
self.Next() # eat the operator.
return UnaryExpressionNode(operator, self.ParseUnary())
# binoprhs ::= (binary_operator unary)\* def ParseBinOpRHS(self, left,
# binoprhs ::= (binary_operator unary)* def ParseBinOpRHS(self, left,
left_precedence): # If this is a binary operator, find its precedence.
while True: precedence = self.GetCurrentTokenPrecedence()
@ -1246,7 +1224,7 @@ the if/then/else and for expressions:
# expression ::= unary binoprhs def ParseExpression(self): left =
self.ParseUnary() return self.ParseBinOpRHS(left, 0)
# prototype # ::= id '(' id\* ')' # ::= binary LETTER number? (id, id) #
# prototype # ::= id '(' id* ')' # ::= binary LETTER number? (id, id) #
::= unary LETTER (id) def ParsePrototype(self): precedence = None if
isinstance(self.current, IdentifierToken): kind = 'normal'
function_name = self.current.name self.Next() # eat function name. elif
@ -1331,7 +1309,7 @@ the if/then/else and for expressions:
# Install standard binary operators. # 1 is lowest possible precedence.
40 is the highest. g_binop_precedence['<'] = 10
g_binop_precedence['+'] = 20 g_binop_precedence['-'] = 20
g_binop_precedence['\*'] = 40
g_binop_precedence['*'] = 40
# Run the main "interpreter loop". while True: print 'ready>', try: raw
= raw_input() except KeyboardInterrupt: break