Question

Draw or write in ASCII the symbol table the compiler would create after compiling the following...

Draw or write in ASCII the symbol table the compiler would create after compiling the following SimpleC program. Then indicate for each variable, which lines (1) add the variable to the table, (2) store the variable, or (3) load the variable.

1 int x;
2 int y;
3 read x;
4 y = x + 1;
5 print y;
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Lines 1 & 2 adds the variables x & y to the symbol table
Consider symbol table has data-type, symbol entries.

    [data-type    symbol]
       int          x
       int          y


Line 3, (read x), loads the symbol x from symbol table for reading the value and storing it into x.


Line4, (y = x + 1), loads the symbol x from symbol table, adds 1 to it and then store result into y.


Line 5, (print y), loads the symbol y from symbol table for printing the value of y.

Add a comment
Know the answer?
Add Answer to:
Draw or write in ASCII the symbol table the compiler would create after compiling the following...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Problems: 1. Write a program to define the following variables, assign them values, and print their...

    Problems: 1. Write a program to define the following variables, assign them values, and print their values on screen: Integer x = 20, Float y = 40.45 Double z = 91.51e+5 Char w = A • • For the integer variable x, you need to print it in decimal notations, octal notations and hexadecimal notation. For the double variable y, you need to print it in double notations and scientific notation. 2. Write a program with the following three parts:...

  • u also need to store the letters' ASCII number in the freq array 4. [8] Write...

    u also need to store the letters' ASCII number in the freq array 4. [8] Write a C function with prototype · void letter_freq(const char word[], int freq []); This function computes the number of appearances of each letter in the string word and stores them in array freq of size 26. The letters are the 26 letters of the Latin alphabet whose ASCII values are in the range 97-122 for the lower case letters, and in the range 65-90...

  • Java program GCompound Practice Exercise CS141 Assignment Write a class that represents a digital snowman. Your...

    Java program GCompound Practice Exercise CS141 Assignment Write a class that represents a digital snowman. Your class should follow these guidelines: 1. Store the following private class variables bodyColor of type Color b. int x, int y for the upper left corner Graphics g. a. C. 2. Create two different constructor methods a. A (int x, int y, Graphics myG) parameter constructor that makes the snowman a light gray color by default and makes x and y the upper left...

  • Using PuTTY Linux Server Task Compiling:             1) Download the two files from blackboard, driver.cpp, and...

    Using PuTTY Linux Server Task Compiling:             1) Download the two files from blackboard, driver.cpp, and circle.h             2) Create a new directory to store the files in             3) Compile the code a) Run the command g++ driver.cpp -o executable_name, this will compile the code both for driver.cpp and the referenced file circle.h note: -o parameter specifies a new name for the executable, if you do not specify the “-o” parameter the default name of the executable is “a.out”...

  • Assignment: Show the symbol table for the following C programs at the printf lines (a) using lexi...

    Assignment: Show the symbol table for the following C programs at the printf lines (a) using lexical scope and (b) using dynamic scope. What does the program print using each kind of scope rule? Program 1: const int b = 10; int foo() {    int a = b + 10;    return a; } int bar() {    int b = 4;    return foo(); } int main() {    printf(“foo = %d\n”,foo());    printf(“bar = %d\n”,bar());    return 0; } Program 2: int a;                 void...

  • Java using data structures The objective is to create your own Hash Table class to hold...

    Java using data structures The objective is to create your own Hash Table class to hold a list of employees and their ID numbers. I've provided the TableEntry class which will be each data object in the hash table. The list of employees will be provided as a .txt file and must be read with the code. please create a .txt file called Employees.txt with the info provided so that the java code can read it in. Employees.txt: (No WhiteSpace...

  • Three of these function overloads are considered identical by the compiler and would conflict with each...

    Three of these function overloads are considered identical by the compiler and would conflict with each other. The other would be considered different- choose the one that is considered different from others. Int foo ( int x, double y ) ; Int foo ( double x, int y ) ; Void foo ( int x, double y ) ; Int foo ( int day, double temp ) ; Consider the following incomplete code: Int f ( int number ) }...

  • Create a CPP file for a C++ Program. Write exactly these functions, power(x,y) function and a...

    Create a CPP file for a C++ Program. Write exactly these functions, power(x,y) function and a print(text, number) function and the main() function. The power(x,y) function returns an integer result that is calculated by raising a number x (integer) to a power y (integer). The second argument y (exponent) of the function can not exceed 100. If the second argument exceeds 100, the function should return -1. Your power(x,y) function must be able to take either 1 or 2 integer...

  • Question 7 (a) Write a C program that performs the following tasks: 1. Create a text...

    Question 7 (a) Write a C program that performs the following tasks: 1. Create a text file to store a list of numbers. 2. Read a number entered by a user and store it into the text file until a negative number is entered. (b) Write a C program that performs the following tasks: 1. Open the text file that contains a list of numbers. 2. Print the list of numbers stored in the text file on the screen.

  • Write a simple Java program with the following naming structure: Open Eclipse Create a workspace called...

    Write a simple Java program with the following naming structure: Open Eclipse Create a workspace called hw1 Create a project called hw1 (make sure you select the “Use project folder as root for sources and class files”) Create a class called Hw1 in the hw1 package (make sure you check the box that auto creates the main method). Add a comment to the main that includes your name Write code that demonstrates the use of each of the following basic...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT