In a team of three or four students, convert the input program (below) into a series of tokens then place each token in an LCRS (left-child, right-sibling) binary tree. There should be one token per tree node. The program below is defined by our ChagaLite programming programming language.
Please use the BNF document for the ChagaLite programming language. Since this is an in-class exercise, please ask me questions if you need any help.
procedure fizzbuzz (int counter) { int state; state = 0; if ((counter % 3) == 0) { state = 1; } if ((counter % 5) == 0) { state = state * 2 + 2; } if (state == 1) { printf ("Fizz"); } else { if (state == 2) { printf ("Buzz"); } else { if (state == 4) { printf ("Fizzbuzz"); } else { printf ("%d", counter); } } } } procedure main (void) { int counter; counter = 1; while (counter <= 100) { fizzbuzz (counter); counter = counter + 1; if (counter <= 100) { printf (", "); } else { printf ("\n"); } } }
Since this is a group assignment, please write the names of each member of the team student on your assignment submission along with "Exercise 3a: Concrete Syntax Tree".