CraigStuntz/Lbac

Tidy Chapter 2 by moving recursive functions inline with callers.

• Loading branch information...
1 parent 03d99c4 commit b7cabf078f2abdd322730ed45aed85e13a2158ee committed Feb 2, 2012
Showing with 12 additions and 14 deletions.
1. +12 −14 Lbac.Compiler/Part02-ExpressionParsing.fs
26 Lbac.Compiler/Part02-ExpressionParsing.fs
 @@ -28,13 +28,12 @@ /// member x.term() = let head = x.factor() - x.termTail head - - member private x.termTail head = - match x.look with - | '*' -> x.termTail ( head @ x.multiply() ) - | '/' -> x.termTail ( head @ x.divide() ) - | _ -> head + let rec termTail head = + match x.look with + | '*' -> termTail ( head @ x.multiply() ) + | '/' -> termTail ( head @ x.divide() ) + | _ -> head + termTail head /// /// ::= () | @@ -58,13 +57,12 @@ else x.term() // rest of expression is evaluated recurively for forms like 1+2-3+4... - x.expressionTail head - - member private x.expressionTail head = - match x.look with - | '+' -> x.expressionTail( head @ x.add() ) - | '-' -> x.expressionTail( head @ x.subtract() ) - | _ -> head + let rec expressionTail head = + match x.look with + | '+' -> expressionTail( head @ x.add() ) + | '-' -> expressionTail( head @ x.subtract() ) + | _ -> head + expressionTail head override x.compile() = x.expression()

0 comments on commit `b7cabf0`

Please sign in to comment.