Sonoma State University
Department of Computer Science
CS-460: Programming Languages
Exercise 4b: Creating a symbol table.

Objective:

With your team, convert the input program (below) into a symbol table. The input program (below) is defined by our C-like programming programming language. Minimally, attributes in the symbol table should include:

  • Name of a procedure including parameter list (inputs to the procedure).
  • Name of a function including parameter list (inputs to the function) and return value (i.e. functions have return values unlike procedures).
  • Name of locally defined variables (within a function or procedure).
  • Name of globally defined variables (outside a function or procedure).
  • The datatype for locally defined variables (e.g. char, bool, int).
  • If a variable is an array, the size of the array (i.e. the number of elements in the array).
  • A scope value for determining scope of variables defined within a function or procedure.
  • A scope value for determining scope of globally defined variables.

Since this is an in-class exercise, please ask me questions if you need any help.

Please use the following input program to create your symbol table:

char buffer[1024];

procedure main (void)
{
  result[0] = TRUE;
  buffer[0] = '\x0';
  some_number = 3;
}

int some_number;

function bool fruit (int kiwi, char banana, int pear)
{
  kiwi = 1;
  mango[0] = 1000;
  return result[0];
}

bool result[5];

procedure do_nothing (void)
{
}

int apple, mango[10], cherry;

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 4b: Creating a Symbol Table".

Exercise 4b Rubric

CRITERIA RATINGS POINTS
Symbol Table Proficient
10 points

A partial or complete list of elements are listed within a symbol table which are relevant to the assignment guidelines above.
Below Expectation
0 points

No solution submitted.
10 points
Total points: 10