CS 536 Intro to Programming Languages and Compliers

  • Slides: 18
Download presentation
CS 536 Intro to Programming Languages and Compliers Spring 2009 Evan Driscoll

CS 536 Intro to Programming Languages and Compliers Spring 2009 Evan Driscoll

“ Introduction to theory and practice of compiler design. Comparison of features of several

“ Introduction to theory and practice of compiler design. Comparison of features of several programming languages and their implications for implementation techniques. Several programming projects required. ”

CS 536 Intro to Programming Languages and Compliers Spring 2009 Evan Driscoll

CS 536 Intro to Programming Languages and Compliers Spring 2009 Evan Driscoll

CS 536 Introduction to Compiler Construction Spring 2009 Evan Driscoll

CS 536 Introduction to Compiler Construction Spring 2009 Evan Driscoll

Not Charles Fischer

Not Charles Fischer

Class home page: http: //cs. wisc. edu/~cs 536 -1/

Class home page: http: //cs. wisc. edu/~cs 536 -1/

What is a compiler? class D : public C { public: int foo(std: :

What is a compiler? class D : public C { public: int foo(std: : string & s); } int D: : foo(std: : string & s) { return s. length(); } Source code (e. g. C++) Compiler 1011010101110000110 101010101010111010 1001011010010010011 100010101010111 000011010010101 0111010100101101001 00100111000101010111010101101010111000011010010 1010111010100101101 01010010010011100010101 Target code (e. g. machine code)

What is a compiler? class D : public C { public: int foo(std: :

What is a compiler? class D : public C { public: int foo(std: : string & s); }; int D: : foo(std: : string & s) { return s. length(); } Source code (e. g. C++) Compiler struct D { struct C; }; Int D__foo(std__string * s) { return std__string_length(s); } Target code (e. g. C)

class D : public C { public: int foo(std: : string & s); }

class D : public C { public: int foo(std: : string & s); } int D: : foo(std: : string & s) { return s. length(); } Compiler 1011010101110000110 101010101010111010 1001011010010010011 100010101010111 000011010010101 0111010100101101001 00100111000101010111010101101010111000011010010 1010111010100101101 01010010010011100010101

class D : public C { public: int foo(std: : string & s); }

class D : public C { public: int foo(std: : string & s); } int D: : foo(std: : string & s) { return s. length(); } Command line args: ‘svn’, ‘stat’, ‘-u’ Results of system calls: readdir. -> foo. txt, bar. c stat foo. txt stat bar. c stat. svn/foo. txt stat. svn/bar. txt Results of network traffic: Communication w/ repo Compiler 1011010101110000110 101010101010111010 1001011010010010011 100010101010111 000011010010101 0111010100101101001 00100111000101010111010101101010111000011010010 1010111010100101101 01010010010011100010101 Output to stdout: M foo. txt ? bar. c Network traffic: Communication wi/ repo

class D : public C { public: int foo(std: : string & s); }

class D : public C { public: int foo(std: : string & s); } int D: : foo(std: : string & s) { return s. length(); } Command line args: ‘svn’, ‘stat’, ‘-u’ Results of system calls: readdir. -> foo. txt, bar. c stat foo. txt stat bar. c stat. svn/foo. txt stat. svn/bar. txt Results of network traffic: Communication w/ repo Compiler Runtime 1011010101110000110 101010101010111010 1001011010010010011 100010101010111 000011010010101 0111010100101101001 00100111000101010111010101101010111000011010010 1010111010100101101 01010010010011100010101 Output to stdout: M foo. txt ? bar. c Network traffic: Communication wi/ repo

class D : public C { public: int foo(std: : string & s); }

class D : public C { public: int foo(std: : string & s); } int D: : foo(std: : string & s) { return s. length(); } Interpreter Command line args: ‘svn’, ‘stat’, ‘-u’ Results of system calls: readdir. -> foo. txt, bar. c stat foo. txt stat bar. c stat. svn/foo. txt stat. svn/bar. txt Results of network traffic: Communication w/ repo Output to stdout: M foo. txt ? bar. c Network traffic: Communication wi/ repo

class D : public C { public: int f( std: : string&s); } Compiler

class D : public C { public: int f( std: : string&s); } Compiler push 5 push add push z multi call bar Various input streams; files, network, command line args, system calls Interpreter Various output methods: files, standard output, files,

class D : public C { public: int f( std: : string&s); } Compiler

class D : public C { public: int f( std: : string&s); } Compiler push 5 push add push z multi call bar Various input streams; files, network, command line args, system calls Virtual Machine Various output methods: files, standard output, files,

class D : public C { public: int f( std: : string&s); } push

class D : public C { public: int f( std: : string&s); } push 5 push add push z multi call bar Various input streams; files, network, command line args, system calls Compiler push 5 push add push z multi call bar Control Bytecode Interpreter JIT Compiler Various output methods: files, standard output, files,

Runtime class D : public C { public: int foo(std: : string & s);

Runtime class D : public C { public: int foo(std: : string & s); } Compiler int D: : foo(std: : string & s) { return s. length(); } class D : public C { public: int f( std: : string &s); } Various input streams; files, network, command line args, system calls 101101010111000011010 01010111010100101101010 10010010011100010101010 101110101010101110 0001101001010111010 1001011010010010011100010 1010101011101010110 101011100001101001010101110101001011010010 010011100010101 class D : public C { public: int f( std: : string&s); } Interpreter Various output methods: files, standard output, files, push 5 push add push z multi call bar Various input streams; files, network, command line args, system calls Compiler push 5 push add push z multi call bar Control Bytecode Interpreter JIT Compiler Various output methods: files, standard output, files,

Runtime class D : public C { public: int foo(std: : string & s);

Runtime class D : public C { public: int foo(std: : string & s); } Compiler int D: : foo(std: : string & s) { return s. length(); } class D : public C { public: int f( std: : string &s); } Various input streams; files, network, command line args, system calls 101101010111000011010 01010111010100101101010 10010010011100010101010 101110101010101110 0001101001010111010 1001011010010010011100010 1010101011101010110 101011100001101001010101110101001011010010 010011100010101 class D : public C { public: int f( std: : string&s); } Interpreter Various output methods: files, standard output, files, push 5 push add push z multi call bar Various input streams; files, network, command line args, system calls Compiler push 5 push add push z multi call bar Control Bytecode Interpreter JIT Compiler Various output methods: files, standard output, files,