DOC PREVIEW
CSU CS 453 - LECTURE NOTES

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS453 Intro and PA1 1CS453 Lecture Symbol Table 1Plan for TodaySymbol Table Uses– “pass info from declarations to uses”Scope– environments– static versus dynamic scope– scope examples– scoping for MiniJava Symbol Table Implementation– info maintained and basic operation– how type information is represented with SymTable and Type data structuresCS453 Lecture Symbol Table 2Scope Terms– environment– scope Example scopes– global scope– file scope– named space– package– unnamed scopes Scoping in MiniJavaCS453 Lecture Symbol Table 3Static versus Dynamic Scope Static Scope– also called lexical scope because can determine scoping by analyzing theprogram– each use of a variable is bound to a location statically Dynamic Scope– each use of a variable is bound to the most recently visible defined valuefor that same variable nameint x = 0;int f () { return x; }int g () { int x = 1; return f(); }CS453 Lecture Symbol Table 4SymTable and STE classes SymTable interface (DO NOT change the outputDot methods)– void insertAndPushScope(NamedScopeSTE ste)– void pushScope(String name)– void popScope()– STE lookup(String sym)– void insert(STE ste)– int outputDot(java.io.PrintStream out, int nodeCount)CS453 Intro and PA1 2CS453 Lecture Symbol Table 5Example SymTable dot outputclass VarError1{ public static void main(String[] a){ System.out.println(1); } }class Class1 { public int foo() { if (a) {} else {} return 0; }}CS453 Lecture Symbol Table 6Using the SymTable


View Full Document

CSU CS 453 - LECTURE NOTES

Download LECTURE NOTES
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view LECTURE NOTES and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view LECTURE NOTES 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?