CM049 : Industrial Computing Project

Download Report

Transcript CM049 : Industrial Computing Project

CM049 : Industrial
Computing Project
Dave Harrison
Office : D202
Phone : 3224
E-Mail : [email protected]
WWW : http://computing.unn.ac.uk/staff/cgdh1
1.1
CM049 : Compiler
Writing For Beginners
Dave Harrison
Office : D202
Phone : 3224
E-Mail : [email protected]
WWW : http://computing.unn.ac.uk/staff/cgdh1
1.2
Unit Overview
• This unit is about software construction.
• Phases 1 - 3 : writing a (cross-)compiler for a
reasonably simple language.
– Host : Jaguar.
– Target : M68Ks in real-time lab.
• Programming language : C++.
– In effect, ANSI C.
• Source language : C-– A subset of ANSII C.
• Target language : M68K assembly.
1.3
Unit Overview II
• Phase 4 : writing a parser for a very simple
language.
– Host : Jaguar.
– Target : None.
• Programming language : Anything you like.
– Provided that it runs on Jaguar.
• Source language : SCL
– The Simple Calculator Language.
• Target language : None.
1.4
Unit Structure
• Formally :
– 12 hours lectures.
– 12 hours directed practical.
• In practice :
– About 8 hours lectures.
– Unlimited (almost) surgery sessions.
– Lots of individual work.
– Lots more individual work.
1.5
Unit Assessment
• Phases 1 - 3 : C-– Three 5 minute software
demonstrations.
– Phase 1 : lexical analysis (10%)
– Phase 2 : syntax analysis (20%)
– Phase 3 : code generation (10%)
• Phase 4 : SCL
– Code printout.
– Copy of code on floppy.
– 60%
1.6
Unit Assessment II
• Marks awarded for
– Functionality.
 How much of C-- and SCL that
your programs handle.
– Good programming practice.
 Comments, layout, variable
names etc.
 Declaring global variables will get
you a 0.
 Global constants are OK.
1.7
Textbooks
• Don’t really need a textbook. I’ll tell you everything
that you need to know.
• If you’re really interested this is the classic text :
Compilers : Principles, Techniques and Tools
Aho A.V., Sethi R. & Ullman J.D.
Addison-Wesley 1986
• Personally, I wouldn’t touch it with a bargepole.
• This is the best book (IMHO) but it’s out of print :
Understanding and Writing Compilers
Bornat R.
MacMillan 1979
1.8
Textbooks II
• If you’re going to get a book this one is suitable :
Crafting A Compiler With C
Fischer C.N. & LeBlanc R.J.
Benjamin / Cummings Publishing Company 1991
• This one might be interesting :
Programming Language Processors In Java
Watt D.A. & Brown R.F.
Pearson Education 2000
• This is just a good book :
1066 And All That
Sellar W.C. & Yeatman R.J.
Mandarin 1991
1.9