MScheme
-
Upload
grady-yang -
Category
Documents
-
view
21 -
download
0
description
Transcript of MScheme
![Page 1: MScheme](https://reader030.fdocuments.net/reader030/viewer/2022033102/56812be5550346895d906177/html5/thumbnails/1.jpg)
Advanced Programming 2009/2010 – Group 23Rui Sebastião56939
José Duarte Lourenço 58515Sofia Teixeira 58600
![Page 2: MScheme](https://reader030.fdocuments.net/reader030/viewer/2022033102/56812be5550346895d906177/html5/thumbnails/2.jpg)
Architecture
Input Processing◦ Algorithm
Environment Notion
Extensions
Glossário
![Page 3: MScheme](https://reader030.fdocuments.net/reader030/viewer/2022033102/56812be5550346895d906177/html5/thumbnails/3.jpg)
Functional Programming
Command pattern
Recursion
![Page 4: MScheme](https://reader030.fdocuments.net/reader030/viewer/2022033102/56812be5550346895d906177/html5/thumbnails/4.jpg)
Main loop Expression Parser
If-else structure
String matching with the language glossary…
… Or Type Matching with Language Types
![Page 5: MScheme](https://reader030.fdocuments.net/reader030/viewer/2022033102/56812be5550346895d906177/html5/thumbnails/5.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022033102/56812be5550346895d906177/html5/thumbnails/6.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022033102/56812be5550346895d906177/html5/thumbnails/7.jpg)
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](https://reader030.fdocuments.net/reader030/viewer/2022033102/56812be5550346895d906177/html5/thumbnails/8.jpg)
Exception handling
![Page 9: MScheme](https://reader030.fdocuments.net/reader030/viewer/2022033102/56812be5550346895d906177/html5/thumbnails/9.jpg)
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?