Presentation is loading. Please wait.

Presentation is loading. Please wait.

ACM SIGCSE ‘04 Using Real Compiler Source Code for Teaching Graduate Compiler Design Elizabeth White Nina Stewart Computer Science Department George Mason.

Similar presentations


Presentation on theme: "ACM SIGCSE ‘04 Using Real Compiler Source Code for Teaching Graduate Compiler Design Elizabeth White Nina Stewart Computer Science Department George Mason."— Presentation transcript:

1 ACM SIGCSE ‘04 Using Real Compiler Source Code for Teaching Graduate Compiler Design Elizabeth White Nina Stewart Computer Science Department George Mason University Ranjan Sen Microsoft Corporation Washington DC

2 ACM SIGCSE ‘04 Graduate Compilers Typical courses in graduate compilers include: Theory –Lexical analysis, Syntax analysis (LL/LR), Semantic analysis (typechecking, intermediate code generation, …) Development of a ‘compiler’ for a small language –Use of theory –Use of tools

3 ACM SIGCSE ‘04 Typical courses in compilers do not include: Access to ‘real’ compiler Access to ‘real’ runtime environment Why? Real compilers are extremely large and complex –C# compiler 200,000+ lines of C++. 138 components

4 ACM SIGCSE ‘04 Integration Options Classroom –Would need strong visualization tools to be effective Directed exercises for individuals –More promising (at least immediately) –Could be assignment based

5 ACM SIGCSE ‘04 Can we integrate ‘real’ compilers into a class like this? Idea: Expose relevant details inside the compiler Tie to input code Hide everything else  Hide and Show

6 ACM SIGCSE ‘04 Hide and Show Implementation: Use a debugging tool on a real compiler. Combine: –Pre-chosen input program –Pre-chosen breakpoints inside source code of the appropriate compiler component Step through the processing of input program and watch how the input program triggers changes. A carefully planned exercise of this type may provide insights that would be difficult to provide to the students using other techniques.

7 ACM SIGCSE ‘04 Should we integrate ‘real’ compilers into a class like this? Will there be value added? –Strengthen understanding of how basic concepts apply? –Strengthen understanding of inter- relationships between parts of a compiler? How to measure value added?

8 ACM SIGCSE ‘04 Potential Benefits Demonstration of abstract concepts in a real compiler Motivate students to explore compiler concepts further Experience with debugging and complex OO code

9 ACM SIGCSE ‘04 Demo Platform: Rotor (SSCLI) C# compiler (http://msdn.microsoft.com/net/sscli )http://msdn.microsoft.com/net/sscli Visual Studio.net Concept: Lexical Analysis – –How are some tokens identified by the lexer? –What happens to the input stream as tokens are found?

10 ACM SIGCSE ‘04 Demo 1.Student starts with: C# input program Instructions for setup of session (VisualStudio.net & DOS) Instructions for Hide & Show session 2.Student follows Hide & Show steps to see given concept demonstration and to answer questions 3.Student encouraged to use current setup to explore concepts further.

11 ACM SIGCSE ‘04 Current Status Basic concept demo: Lexical Analysis Need to –Find the best mechanism to allow students to independently use the demo. –Find mechanism to allow use in classroom. –Expand to additional concepts Integrated into graduate compilers class Fall 2004.

12 ACM SIGCSE ‘04 Future How effective is this approach? Make ‘approach’ available. What additional tools (such as visualization) would make this approach more effective? Expand to see how hide and show can be used at the ‘back-end’ of a compiler. What other areas/courses could this approach be effective in?

13 ACM SIGCSE ‘04 Hide and Show Instructions: (debugger commands, breakpoints C# input file VisualStudio.net Concept Demonstration & Exploration Scanner Parser Optimizer Semantic Analysis Code Generator Symbol Table Target language _parseNumber: fReal = TRUE; while (*p >= '0' && *p <= '9‘) p++; // Number + dot + non-digit -- these are separate tokens, so don't absorb the // dot token into the number. p = pszHold; pFT->iToken = TID_NUMBER; break; } } if (*p == 'E' || *p == 'e‘) { fReal = TRUE; // skip exponent p++; if (*p == '+' || *p == '-‘) p++; while (*p >= '0' && *p <= '9') p++; } … pFT->iToken = TID_NUMBER; break; }


Download ppt "ACM SIGCSE ‘04 Using Real Compiler Source Code for Teaching Graduate Compiler Design Elizabeth White Nina Stewart Computer Science Department George Mason."

Similar presentations


Ads by Google