1 / 18

CS 536

CS 536. Intro to Programming Languages and Compliers Spring 2009 Evan Driscoll. “. Introduction to the theory and practice of compiler design. Comparison of features of several programming languages and their implications for implementation techniques. Several programming projects required.

hali
Télécharger la présentation

CS 536

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

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

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

  4. CS 536 Introduction to Compiler Construction Spring 2009 Evan Driscoll

  5. Not Charles Fischer

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

  7. What is a compiler? class D : public C { public: intfoo(std::string & s); } int D::foo(std::string & s) { return s.length(); } Compiler 101101010101011100001101010100101010101011101010010110101010010010011100010101010101010101110101010101101010101011100001101010100101010101011101010010110101010010010011100010101010101010101110101010101101010101011100001101010100101010101011101010010110101010010010011100010101 Source code (e.g. C++) Target code (e.g. machine code)

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

  9. class D : public C { public: intfoo(std::string & s); } int D::foo(std::string & s) { return s.length(); } Compiler 101101010101011100001101010100101010101011101010010110101010010010011100010101010101010101110101010101101010101011100001101010100101010101011101010010110101010010010011100010101010101010101110101010101101010101011100001101010100101010101011101010010110101010010010011100010101

  10. class D : public C { public: intfoo(std::string & s); } int D::foo(std::string & s) { return s.length(); } Compiler 101101010101011100001101010100101010101011101010010110101010010010011100010101010101010101110101010101101010101011100001101010100101010101011101010010110101010010010011100010101010101010101110101010101101010101011100001101010100101010101011101010010110101010010010011100010101 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

  11. class D : public C { public: intfoo(std::string & s); } int D::foo(std::string & s) { return s.length(); } Compiler 101101010101011100001101010100101010101011101010010110101010010010011100010101010101010101110101010101101010101011100001101010100101010101011101010010110101010010010011100010101010101010101110101010101101010101011100001101010100101010101011101010010110101010010010011100010101 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 Runtime

  12. class D : public C { public: intfoo(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

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

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

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

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

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

More Related