Sonoma State University
Department of Computer Science
CS-460: Programming Languages
Exercise 2b: Tokenization

Objective:

In a team of three or four students, list the tokens and token type (e.g. String, Integer, Right Parenthesis, etc.) which comprise the program below. The program below is defined by the ChagaLite programming programming language.

How do I know what a token is?

Please use the document, Definitions for tokens in Backus-Naur Form.

Please use the following program to identify and label tokens:

function int sum_of_first_n_squares (int n)
{
  int sum;

  sum = 0;
  if (n >= 1)
  {
    sum = n * (n + 1) * (2 * n + 1) / 6;
  }
  return sum;
}
  
procedure main (void)
{
  int n;
  int sum;

  n = 100;
  sum = sum_of_first_n_squares (n);
  printf ("sum of the squares of the first %d numbers = %d\n", n, sum);
}

Submission Instructions:

Since this is a group assignment, please write the names of each member of the team student on your assignment submission along with "Exercise 2b: Tokenization".

Exercise 2b Rubric

CRITERIA RATINGS POINTS
Tokenization Proficient
10 points

A partial or complete list of tokens is labeled and identified which are relevant to the assignment guidelines above.
Below Expectation
0 points

No solution submitted.
10 points
Total points: 10