321-CL5 - { source_text.Remove(0, c);...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Evaluate_Expression { value.Clear(); object Integer term1, term2; while(source_text.Length() > 0) { source_text.Remove(0, c); if((c != '+') and (c != '-')) { Evaluate_Term(source_text, c, term1); } else { if(c == '+') { source_text.Remove(0, c); Evaluate_Term(source_text, c, term2); value = term1 + term2; } else if(c == '-') { source_text.Remove(0, c); Evaluate_Term(source_text, c, term2); value = term1 - term2; } } } } Evaluate_Term { value.Clear(); object Integer factor1, factor2; if((c != '*') and (c != '/')) { Evaluate_Factor(source_text, c, factor1); } else { if(c == '*') { source_text.Remove(0, c); Evaluate_Factor(source_text, c, factor2); value = factor1 * factor2; } else if(c == '/')
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { source_text.Remove(0, c); Evaluate_Factor(source_text, c, factor2); value = factor1 / factor2; } } } Evaluate_Factor { value.Clear(); if((c != '(')) { Evaluate_Digit_Sequence(source_text, c, value) } else { Evaluate_Expression(source_text, c, value); } } Evaluate_Digit_Sequence { value.Clear(); Evaluate_Digit(souce_text, c, value); } Evaluate_Digit { value.Clear(); object Text temp; temp.Add(temp.Length(), c); while(c != '+' and c != '-' and c != '*' and c != '/' and c != '(' and c != ')') { source_text.Remove(0, c); temp.Add(temp.Length(), c); } value = To_Integer(temp); }...
View Full Document

This note was uploaded on 02/27/2012 for the course CSE 321 taught by Professor Bucci during the Winter '11 term at Ohio State.

Page1 / 2

321-CL5 - { source_text.Remove(0, c);...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online