8 Pages

translation

Course: CPSC 411, Fall 2009
School: Wilfrid Laurier
Rating:
 
 
 
 
 

Word Count: 1244

Document Preview

Intermediate Annotated DataType for extended M (vanilla M is basically the same, minus the array descriptions, case statement, and I_REF, I_SIZE operators. It also removes the character and real datatypes) functions, number of local variables, array descriptions, body. data I_prog = I_PROG ([I_fbody],Int,[(Int,[I_expr])],[I_stmt]) function label, local functions, number of local variables, number of arguments...

Register Now

Unformatted Document Excerpt

Coursehero >> Canada >> Wilfrid Laurier >> CPSC 411

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Intermediate Annotated DataType for extended M (vanilla M is basically the same, minus the array descriptions, case statement, and I_REF, I_SIZE operators. It also removes the character and real datatypes) functions, number of local variables, array descriptions, body. data I_prog = I_PROG ([I_fbody],Int,[(Int,[I_expr])],[I_stmt]) function label, local functions, number of local variables, number of arguments array descriptions, body data I_fbody = I_FUN (String,[I_fbody],Int,Int,[(Int,[I_expr])],[I_stmt]) level, offset, array indexes, expressions data I_stmt = I_ASS (Int,Int,[I_expr],I_expr) while loop: expression, statement | I_WHILE (I_expr,I_stmt) If statement: condition expression, statement to execute if true, statement to execute if false | I_COND (I_expr,I_stmt,I_stmt) Case statement for custom data type. Expression, [constructor #, # of arguments to constructor, statement to execute] | I_CASE (I_expr,[(Int,Int,I_stmt)]) Read various types of variables (level, offset, array indexes) | I_READ_B (Int,Int,[I_expr]) | I_READ_I (Int,Int,[I_expr]) | I_READ_F (Int,Int,[I_expr]) | I_READ_C (Int,Int,[I_expr]) Print out values of various types (expression) | I_PRINT_B I_expr | I_PRINT_I I_expr | I_PRINT_F I_expr | I_PRINT_C I_expr | I_RETURN I_expr a block: functions, number of local variables, array descriptions, body. | I_BLOCK ([I_fbody],Int,[(Int,[I_expr]))],[I_stmt]) Values of different base types 1 of 8 Values of different base types data I_expr = I_IVAL Int | I_RVAL Float | I_BVAL Bool | I_CVAL Char Identifier: level offset, array indexes | I_ID (Int,Int,[I_expr]) Apply some operation... expressions as parameters | I_APP (I_opn,[I_expr]) A reference to an array (to pass) level, offset | I_REF (Int,Int) request the size of an array dimension: level,offset,dimension | I_SIZE (Int,Int,Int) Function Call: label and level data I_opn = I_CALL (String,Int) constructor number and number of arguments | I_CONS (Int,Int) Arithmetic operators for integers and floats | I_ADD_I | I_MUL_I | I_SUB_I | I_DIV_I | I_NEG_I | I_ADD_F | I_MUL_F | I_SUB_F | I_DIV_F | I_NEG_F comparison operators for various types | I_LT_I | I_LE_I | I_GT_I | I_GE_I | I_EQ_I | I_LT_F | I_LE_F | I_GT_F | I_GE_F | I_EQ_F | I_LT_C | I_LE_C | I_GT_C | I_GE_C | I_EQ_C logical connectives | I_NOT | I_AND | I_OR type casting: (integer > float, float > integer, float >integer) | I_FLOAT | I_FLOOR | I_CEIL Intermediate code example 2 of 8 Intermediate code example Original source code: /* Fibonacci ... */ var n:int fun fib(n:int):int {var z:int begin if n =< 1 then z:= 1 else z:= fib(n 1) + fib(n 2) return z end} begin read n print fib(n) end Abstract Syntax Tree: M_prog ( [ M_var ("n",[],M_int), M_fun ("fib", [("n",0,M_int)], M_int, [M_var ("z",[],M_int)], [M_cond (M_app (M_le,[M_id ("n",[]),M_ival 1]), M_ass ("z",[],M_ival 1), M_ass ("z",[], M_app (M_add, [M_app (M_fn "fib",[M_app (M_sub,[M_id (" n" , []),M_ival 1])]), M_app (M_fn "fib",[M_app (M_sub,[M_id ("n",[]), M_ival 2])])]))), M_return (M_id ("z",[])) ]) ], [M_read ("n",[]), M_print (M_app (M_fn "fib",[M_id ("n",[])]))]) Symbol Table (when trying to generate code for the recursive call): 3 of 8 Symbol Table (when trying to generate code for the recursive call): [ symbol_table 1, ( 1, [var (n, int, 4), var (z, int, 1) ]), symbol_table (1, 0, [var (n, int, 1), func (fib, int, [int], code_label_fib_1319)])] Intermediate Representation: I_PR OG ( [I_FUN (code_label_fib_1319, [], 1, 1, [], [ statements I_APP (I_LE_I, [I_ID (0, 4, []), I_IVAL 1]), I_ASS (0, 1, [], I_IVAL 1), I_ASS (0, 1, [], I_APP (I_ADD, [ I_APP( I_CALL (code_label_fib_1319, 1), [I_A PP (I_S UB_I, [I_ID (0, 4, []), I_INT 1]), I_APP( I_CALL (code_label_fib_1319, 1), [I_A PP (I_S UB_I, [I_ID (0, 4, []), I_INT 2]) ] RETURN (I_ID (0, 1, []) ]) ], 1, [], [ I_READ_I (0, 1, []), I_PRINT_I (I_APP (I_CALL (code_label_fib_1319, 0), I_ID (0, 1, []))) ] ) I_COND ( AM Stack Machine Code 4 of 8 AM Stack Machine Code % Note that I used the code label from the % sample symbol table you' d end up % with a label number other than 1319 % Setup storage for main LOAD _R %sp LOAD _R %sp STOR E_R %fp ALLO C 1 % S etup deallocation counter LOAD _I 3 % read(n) READ _I LOAD _R %fp STOR E_O 1 % setup caller portion of activation record for fib LOAD _R %fp LOAD _O 1 ALLO C 1 LOAD _R %fp LOAD _R %fp LOAD _R %cp JUMP code_label_fib_1319 % print the resulting value PRINT _I % use deallocation counter to free used storage LOAD _R %fp LOAD _O 2 ALLO C_S % program is done HALT code_label_fib_1319: % S etup frame pointer LOAD _R %sp STOR E_R %fp % A llocate local variable storage ALLO C 1 % this line and the next setup the frame pointer 5 of 8 % S etup deallocation counter LOAD _I 2 % first part of the if statement: % test N <= 1 LOAD _R %fp LOAD _O 4 LOAD _I 1 APP L E % jump to else clause if test fails JUMP _C labelelse % z := 1 LOAD _I 1 LOAD _R %fp STOR E_O 1 % jump to end of if statement JUMP endofif labelelse: % N eed to add tw o values together to determine % new value of z % calculate fib(n 1) LOAD _R %fp LOAD _O 4 LOAD _I 1 APP S UB ALLO C 1 LOAD _R %fp % note that for both recursive calls w e % need to follow the static link back % once to find our environment LOAD _R %fp LOAD _O 1 LOAD _R %cp JUMP code_label_fib_1319 % calculate fib(n 2) ...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Laurentian - D - 0994021
P109 Huntington University fondsP109 Huntington University fonds ca. 1762-2002 [predominant dates 1958-1976] 2.61 of textual records and other types of records Administrative history: &quot;Founded in 1960, Huntington University is a liberal arts univer
Laurentian - CDE - 71933
2008NORTHEASTERN NATURALIST15(3):417430Demography of an Island Population of Spotted Turtles (Clemmys guttata) at the Species' Northern Range LimitDan J. Reeves1 and Jacqueline D. Litzgus1,*Abstract - Demographic information from geographical
Laurentian - ACAPLAN - 0203
NOTES from the Academic Planning Committee held on Tuesday, September 10, 2002 at12:00 noon in L-302. PRESENT: G. Allaire, Chair J. Leidl A. Noakowski H. Pallard S. Gauthier G. Duquette C. Sinclair K. Westaway A. Thomson D. Parker B. Dew L. Mainville
Laurentian - CELP - 0304
NOTES from the Council of English Language Programmes held on Wednesday, May 12, 2004 at 10:00 a.m. in L-302. PRESENT: S. Burke C. Leonard L. Marcotte P. Pickard A. Thomson K. Westaway D. Parker, Chair L. Mainville, Recording Secretary 1. Approval of
Wilfrid Laurier - CPSC - 411
Examples from the Context-Free Grammar Checker: Example 1: L -&gt; | V -&gt; | Var -&gt; V ( args ) L equals Var ( ). Var + V id. id.nonterminal L V Varfirst set id id idfollow set equals ( (+nullable no no noendable yes no noExample 2: S -&gt; | | |
Laurentian - C - 30324
Risk Management and Purchasing Services 935 Ramsey Lake Road SUDBURY, ON P3E 2C6 (705) 675-1151 ext. 1532 Fax (705) 675-4820Short Term Lease Over 30 days to 12 months Request to Add/Delete DriverIt is the responsibility of each Department using U
Wilfrid Laurier - CPSC - 457
CPSC 457 T03Filesystems November 19, 2008 David Aikema aikema@cpsc.ucalgary.ca1Outline Files and operations Directory Structures Filesystem mounting File sharing Access protection2Source: Ch. 10 of your course textWhat's a file?P
Wilfrid Laurier - CPSC - 457
CPSC457T03SchedulingDavidAikema aikema@cpsc.ucalgary.ca October15,20081OutlineGraphicsfromhome Scheduling UMLupdatedOnalllabmachinesmaybeafewservers TrygettingthatsystemcallworkingAssignment1HandbackAttheend2GraphicsfromhomeWindowsNe
Allan Hancock College - JM - 601
JM601ServicesMarketingTeachingpersonnelJessie Harman (lectures)B014WelcometoJM601Unit objectives: To understand the importance of the services sector in an advanced economy To appreciate the distinctive nature of services
Wilfrid Laurier - CPSC - 457
CPSC 457 T03Memory Management November 5, 2008 David Aikema aikema@cpsc.ucalgary.ca1Outline Paging (continued) Segmentation Virtual memory How does this work in Linux?Assignment 2 Results2Where did we leave off?Ended off talking ab
Wilfrid Laurier - CPSC - 457
CPSC 457 T03Filesystem Implementation November 24, 2008 David Aikema aikema@cpsc.ucalgary.ca1Outline Filesystem Structure Virtual Filesystem Directory Implementation Allocation Methods Free Space Management Efficiency Recovery Managemen
Allan Hancock College - BM - 404
Understandingcustomer requirementsBM404 Week 4ProviderGap1CUSTOMER Expected ServiceCOMPANYListening Gap Company Perceptions of Consumer ExpectationsPart 3 OpenerSessionoverview Using Marketing Research to Understand Customer Ex
Wilfrid Laurier - CPSC - 457
CPSC 457 T03Virtual Memory November 12, 2008 David Aikema aikema@cpsc.ucalgary.ca1Outline Virtual memory Paging Other considerations Spinlocks Passing data through system calls2Source: Chapter 9 of your course textbookVirtual memory
Laurentian - AEF - 33117
(Article per LUFAs Collective Agreement) ARTICLE 4.52 - PROFESSIONAL DEVELOPMENT EXPENDITURES 1. In order to further the objectives of the University, the creation and dissemination of knowledge, the activities of each full-time Member shall be suppo
Allan Hancock College - BM - 404
DELIVERING AND PERFORMING SERVICEProvider Gap 3CUSTOMERCOMPANYService Delivery Service Performance Gap Customer-Driven Service Designs and StandardsPart 5 OpenerEmployees Roles in Service Delivery Demonstrate the importance of creating a
Wilfrid Laurier - CPSC - 457
CPSC 457 T03Midterm Review October 27, 2008 David Aikema aikema@cpsc.ucalgary.ca OutlineGo through the sample midterm (and a few more terms)and / orAnswer your questions Do you want a tutorial on Wednesday? Section 1Multiple Choi
Laurentian - B - 6332692
International Economic Policy Institute Institut International dEconomie Politique International Economic Policy Institute Institut International dEconomie Politique T SUSTAINABILITY Policy Institute International HEEconomic OF FISCAL POLICY: AN OLD
Wilfrid Laurier - CPSC - 457
CPSC 457 T03System Calls and the Linux KernelDavid Aikema aikema@cpsc.ucalgary.ca October 6, 20081OutlineSystem CallsSystem Call HandlerModifying the Linux kernel Problems Adding a new system call Recompiling TestingSource: Lin
Allan Hancock College - BM - 404
MarketingService OrganisationsBM404 2006 Lecture 2Overview Defining services Understanding the services economy The service sector in Australia Mega-trends and the service sector:Professional services Characteristics of services Marke
CSU Fullerton - OPER - 2110
CHAPTER 16 MATERIALS PLANNING FOR DEPENDENT DEMANDChapter OverviewThe previous chapter addressed the needs of inventory control when demand is independent and nearly constant. This chapter examines the opposite-dependent and lumpy demand. This is h
Laurentian - NR - 24487
For immediate distributionFriday, April 18, 2008Appointment of acting presidentDr. Woodsworth has resigned as president of Laurentian University effective July 31, 2008. She will be at Laurentian until that date, fully engaged in completing the
Laurentian - NR - 30486
For immediate distributionTuesday, December 9, 2008Laurentian University appoints Dominic Giroux as new presidentSudbury (Ontario) - Laurentian Universitys Board of Governors is pleased to announce the appointment of Dominic Giroux as president
Wilfrid Laurier - CPSC - 457
CPSC 457 T03Shell ProgrammingDavid Aikema aikema@cpsc.ucalgary.ca Sept 24, 20081OutlineShell scriptingQuick reference card Source: http:/steve-parker.org/sh/cheatsheet.pdf Licensed for personal use only, which means that you'll need t
Laurentian - NR - 28529
For immediate distributionThursday, August 28, 2008Laurentian University professor receives grant from Social Sciences and Humanities Research Council of CanadaSudbury (Ontario) Laurentian University is pleased to announce that Dr. Benot Grenie
Laurentian - CA - 23697
For immediate distributionThursday, March 27, 2008Professor Ginette Michel receives the Teaching Excellence AwardSudbury (Ontario) - Laurentian University is proud to announce that professor Ginette Michel, School of Human Kinetics, is the recip
Laurentian - CC - 30717
For immediate distributionThursday, January 8, 2009An evening of creation in honour of Acadian artist Hermngilde ChiassonSudbury (Ontario) Laurentian Universitys Arts dexpression program, in collaboration with ditions Prise de parole, Salon du
Laurentian - NR - 31019
For immediate distributionWednesday, January 21, 2009ITALIAN THEATRE AT LAURENTIAN UNIVERSITYSudbury (Ontario) - For the 17th consecutive year, Le Maschere Laurenziane, a student threatre troupe housed in Laurentian Universitys Italian studies p
Laurentian - NR - 24986
For immediate distributionWednesday, April 30, 2008Laurentian veterinarian and animal care director elected to the Board of the American Animal Hospital AssociationSudbury (Ontario) Laurentian University is pleased to announce that Dr. Rod Joup
Wilfrid Laurier - CPSC - 457
751371275598491921784863472813633955016433858855220567330841737666238285132100945960974653994528618776935796154165682246790117492235891218404826299262107970886391423
CSU Fullerton - OPER - 2110
COURSE OUTLINECourse Name and Code Total Hours Credits ADVANCED OPERATIONS MANAGEMENT OPER2110 45 3 (2008-2009)1Prerequisite(s) Corequisite(s)Course Description The term operations management refers to the direction and control of the processe
Wilfrid Laurier - CPSC - 457
[carey@csl 2008]$ pwd/home/dsl/carey/classes/CPSC457/2008[carey@csl 2008]$ ls -ltotal 484drwx- 5 carey profs 4096 Sep 23 22:48 330drwxr-xr-x 13 carey profs 4096 Oct 2 13:18 ass1drwxr-xr-x 2 carey profs 4096 Oct 10 13:58 ass2drwxr-xr-x 2 carey
Laurentian - ACAPLAN - 0506
ACADEMIC PLANNING COMMITTEE 2005-20062005 Timetable OCTOBER NOVEMBER Meeting room L-302 Meeting room L-302 Meeting room L-302 Meeting room DA102 Meeting room L-302 Friday, October 28, 2005 Friday, November 11, 2005 Friday, November 25, 2005 Friday,
Concordia Canada - ENGR - 361
Tutorial Problems:
Laurentian - CELP - 0405
NOTES from the Council of Engish Language Programme held on February 3, 2005 at 2:30 p.m. in L-302. PRESENT: S. Silverton, Chair R. Smith D. MCreath P. Pickard C. Leonard A. Thomson M. Orr A. Perlini L. Mainville, Recording Secretary 1. Approval of t
Wilfrid Laurier - CPSC - 441
S t Program ing with TC ocke m PDavid Aike a m Em aike a@ ail: m cpsc.ucalgary.ca Hom page e :http:/page s.cpsc.ucalgary.ca/~aike a/TA/cpsc441W09 m Office I C 720A : T Te 403-210-9408 l:S s by Ajay Gopinathan lideI ntroduction1-1Trying out H
Laurentian - BDD - 85741
Directions to the Holiday Inn Sudbury (1696 Regent St.) From Sudbury Airport : From Airport, turn right onto Skead Rd; follow Skead Rd to Radar Rd. Turn left to Falconbridge Hwy. Follow sign to and through Garson Township. Follow Falconbridge Hwy Sou
Laurentian - D - 0177068
Student: Lynne Cheliak Academic Supervisor: Dr. Hoi Cheu Organization Supervisor: Ms. Patti Mullins Organization: Pavilion Family Resource Centre, Haileybury 18 April 2005 The Paradox of Power in Feminist Counselling The Pavilion Family Resource Cent
Laurentian - DA - 816
Sudbury Sexual Assault Crisis Centre The SSACC is a non-profit organization, that specializes in providing support, information and counselling to women who have survived sexual violence.
Laurentian - STAT - 2246
Exploratory Data Analysis Lecture 8, STAT 2246Julien DompierreDpartement de mathmatiques et dinformatique e e Universit Laurentienne e23 janvier 2007, SudburyJulien Dompierre1Exploratory Data Analysis (p. 159)From Bluman: The purpose of ex
CSU Fullerton - PROG - 1030
Course Requirements Sheet Course Name: Introduction to C programming language Course Number: PROG1030Revision Date: April 16, 2009It is the responsibility of the student to read and understand this Course Requirements Sheet. Instructor: Email: Ph
CSU Fullerton - OPER - 2110
Course Requirements Sheet Course Name: Advanced Operations Management Course Number: OPER2110Revision Date: April 13, 2009It is the responsibility of the student to read and understand this Course Requirements Sheet. Instructor: Email: Phone: Cou
Laurentian - D - 1662
Biology Options The General Program and the Specialized Program have a common first year that consists of 6 credits each of Biology, Chemistry, Mathematics, and Physics, and 6 credits from the Social Sciences or Humanities. Bachelor of Science (Gener
CSU Fullerton - PROG - 1880
Programming Logic and DesignFifth Edition, ComprehensiveChapter 7 Using MethodsObjectives Review how to use a simple method with local variables and constants Create a method that requires a single parameter Create a method that requires mult
Laurentian - E - 1868428
CSU Fullerton - QM - 3010
Quantitative Methods: ASSIGNMENT 1Due Date:_A staff member for a utilities commission gathered information on the average price of electricity in a random sample of 28 Canadian cities. The average price per kilowatt hour for residential customers
Laurentian - FD - 264
Cover Letter TipsCover letters allow you an opportunity to use the narrative form to describe yourself and your achievements. The cover letter is often used to arouse the interest of the employer, so do not use a passive voice when writing. You want
Laurentian - CBAB - 468
NOUNS 2008Northern Ontario United Nations Simulation 2008 6, 7 &amp; 8 November 2008Registration formName : First name : University : _ _ _Selected committee (list two by order of preference) 1. _ 2. _ Country you wish to represent (list three by or
Laurentian - BE - 697
The degree programThis is a joint 4-year program offered by Laurentian University and The Michener Institute for Applied Health Sciences, leading to a B.Sc. in Radiation Therapy. The curriculum includes courses at Laurentian, specialized courses ava
Laurentian - CELP - 0405
NOTES from the Council of English Language Programmes held on January 6, 2005 at 2:30 p.m. in L302. PRESENT: S. Silverton, Chair R. Smith P. Pickard C. Leonard M. Bray A. Thomson B. Brockerhoff-Macdonald M. Orr A. Perlini 1. Approval of Agenda The ag
Laurentian - CELP - 0405
NOTES from the Council of English Language Programmes held on November 25, 2004 at 2:30 p.m. in L-302. PRESENT: REGRETS:S. Silverton, Chair M. Bray D. McCreath R. Smith A. Thomson M. Orr A. Perlini P. Pickard L. Mainville, Recording Secretary 1. Ap
Laurentian - D - 0397308
** ** 5234 Proteins analysed ** Proteins which fit the criteria 914 ** 17.5 % of the total sequence analysed ** **** CRITERIA * Input File : C:\Catharine\GenomesG+\Bcereus.txt -
Laurentian - MATH - 1056
Proof Methods and Strategy Discrete Mathematics I MATH/COSC 1056EJulien DompierreDepartment of Mathematics and Computer Science Laurentian UniversitySudbury, September 24, 2008Proof Methods and Strategy1Proof by CasesWe want to prove the
Laurentian - E - 5065
2005-2006 Donors under $500Wemakeeveryattempttoensureaccuracyofinformation,sopleasecontactourdepartmentto communicateanyerrorsoromissionsat(705)4872. 10thFloorFund A&amp;UDunlop AbbasAbdulhusein OvieAbolor BaldwinAbuwa PatriciaAchiume JoanneAdam Newto
Allan Hancock College - HX - 508
1492-1992These two dates in the title encapsulate a whole historical experience of colonialism in the Americas. Its been controversial. In 1992, there was a commemoration of the Quincentenary of the founding of modern America, or the Discovery of Am
Concordia Canada - LYRA - 1277
INTERNAL MEMORANDUMTO: FROM: DATE: RE:Jack Lightstone, Provost and Vice-Rector, Research Christopher Jackson, Dean, Faculty of Fine Arts June 9, 2002 University Appraisal Committee Recommendations The Mel Hoppenheim School of CinemaIn accordanc
Laurentian - B - 9303520
Laurentian University / Universit Laurentienne MEMORANDUM TO: FROM: RE: Ron Chrysler, Vice President of Administration and Finance Ron Larwood, Chairman P. E .S . Advisement C.E. Lefroy, Director of Phys-Ed. Policy decision on Social Events at the L
UAB - PHYS - 130
page 1 of 3December 14th,2007 FinalExam Physics130Sections220/221 Dr.E.HackettDuration: 3hours Aidspermitted: calculator formulasheet2sidesofan8.5&quot;x11&quot;sheet Instructions:Attemptall9questions.Questionsarenot equallyweighted.Marksare showninbracket
UAB - ENCP - 100
TopicsOne-dimensional arrays Arrays and functions C-style strings Predefined functions for string manipulationReferenceC+ Programming From Problem Analysis to Program Design: Chapter 9ENCP 100 Week #8Grant MacEwan College - Winter 2009 Mr. M
Wilfrid Laurier - GEOG - 305
Name:_ Lab Section:_ Lab #2: Heat Transfer &amp; Energy Balance Part 1: Heat Transfer In this section of lab you will be exploring heat transfer. Remember that heat is transferred in the atmosphere by conduction, convection, advection, and radiation. Con
Laurentian - NR - 22120
Background Information about SNOLAB and its ExperimentsSNOLAB is Canada's leading edge astroparticle physics research facility located 2 kilometers underground in the Vale Inco Creighton Mine near Sudbury Ontario. The project began in 1990 as the Su