Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Token list:
- (int)
- (main, identifier)
- ((, lparen)
- (void)
- (), rparen)
- ({, lcurly)
- (int)
- (num, identifier)
- (,, comma)
- (denom, identifier)
- (,, comma)
- (quot, identifier)
- (,, comma)
- (rem, identifier)
- (;, end_statement)
- (read)
- (num, identifier)
- (,, comma)
- (denom, identifier)
- (;, end_statement)
- (if)
- (denom, identifier)
- (=, logical)
- (0, integer)
- (then)
- (write, identifier)
- ((, lparen)
- ("the denominator has an invalid value 0!", string)
- (), rparen)
- (;, end_statement)
- (else)
- ({, lcurly)
- (rem, identifier)
- (:=, assignment)
- (num, identifier)
- (;, end_statement)
- (quot, identifier)
- (:=, assignment)
- (0, integer)
- (;, end_statement)
- (while)
- (rem, identifier)
- (>=, logical)
- (denom, identifier)
- (do)
- ({, lcurly)
- (rem, identifier)
- (:=, assignment)
- (rem, identifier)
- (-, add/sub)
- (denom, identifier)
- (;, end_statement)
- (quot, identifier)
- (:=, assignment)
- (quot, identifier)
- (+, add/sub)
- (1, integer)
- (;, end_statement)
- (}, rcurly)
- (;, end_statement)
- (write, identifier)
- ((, lparen)
- ("quotient = ", string)
- (,, comma)
- (quot, identifier)
- (), rparen)
- (;, end_statement)
- (write, identifier)
- ((, lparen)
- ("remainder = ", string)
- (,, comma)
- (rem, identifier)
- (), rparen)
- (;, end_statement)
- (}, rcurly)
- (;, end_statement)
- (}, rcurly)
- Symbol table:
- (main, identifier)
- (num, identifier)
- (denom, identifier)
- (quot, identifier)
- (rem, identifier)
- (0, integer)
- (write, identifier)
- ("the denominator has an invalid value 0!", string)
- (1, integer)
- ("quotient = ", string)
- ("remainder = ", string)
- Syntax tree:
- (int)
- (main, identifier)
- ((, lparen)
- (void)
- ({, lcurly)
- (int)
- (num, identifier)
- (denom, identifier)
- (quot, identifier)
- (rem, identifier)
- (read)
- (num, identifier)
- (denom, identifier)
- (if)
- (=, logical)
- (denom, identifier)
- (0, integer)
- (then)
- (write, identifier)
- ((, lparen)
- ("the denominator has an invalid value 0!", string)
- (else)
- ({, lcurly)
- (:=, assignment)
- (rem, identifier)
- (num, identifier)
- (:=, assignment)
- (quot, identifier)
- (0, integer)
- (while)
- (>=, logical)
- (rem, identifier)
- (denom, identifier)
- (do)
- ({, lcurly)
- (:=, assignment)
- (rem, identifier)
- (-, add/sub)
- (rem, identifier)
- (denom, identifier)
- (:=, assignment)
- (quot, identifier)
- (+, add/sub)
- (quot, identifier)
- (1, integer)
- (write, identifier)
- ((, lparen)
- ("quotient = ", string)
- (quot, identifier)
- (write, identifier)
- ((, lparen)
- ("remainder = ", string)
- (rem, identifier)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement