9
Advanced Programming 2009/2010 – Group 23 Rui Sebastião56939 José Duarte Lourenço 58515 Sofia Teixeira 58600

MScheme

Embed Size (px)

DESCRIPTION

MScheme. Advanced Programming 2009/2010 – Group 23 Rui Sebastião56939 José Duarte Lourenço 58515 Sofia Teixeira 58600. Agenda. Architecture Input Processing Algorithm Environment Notion Extensions Glossário. Architecture. Functional Programming Command pattern Recursion. - PowerPoint PPT Presentation

Citation preview

Page 1: MScheme

Advanced Programming 2009/2010 – Group 23Rui Sebastião56939

José Duarte Lourenço 58515Sofia Teixeira 58600

Page 2: MScheme

Architecture

Input Processing◦ Algorithm

Environment Notion

Extensions

Glossário

Page 3: MScheme

Functional Programming

Command pattern

Recursion

Page 4: MScheme

Main loop Expression Parser

If-else structure

String matching with the language glossary…

… Or Type Matching with Language Types

Page 5: MScheme

Check the car of incoming cons If it is a known command, execute it with

our eval nodes Inside each eval node:

◦ Evaluate recursively with Expression Parser the car of the expression received until it is of a known type

Page 6: MScheme

If it is of a known type, perform adequate evaluation◦ Self evaluating expressions◦ Cons expressions◦ Symbols that are Functions and must evaluate

again on Expression Parser

Page 7: MScheme

At the beginning of the program, an initial environment is set with the known types

On each let, let* instruction & lambda a new internal environment is pushed into our List of Environments

At the end of its execution, the stack pointer returns to the global environment

Page 8: MScheme

Exception handling

Page 9: MScheme

define lambda

cond, if begin

let, let*, letreccar, cdr, cons, apply, map,

member

+, -, *, /jcall, jnew, jmethod, jconstructor, jtype

remainder, quotientJnull, jstring, jboolean, jchar,

jdouble, jfloat, jint, jlong, jbyte, jshort

<, >, >=, <= set!, set-car!, set-cdr!

not, eq?, =, null? ‘, quote, list

and, or function?, number?, pair?