CC41A -
Lenguajes de Programación
Éric
Tanter
2007/1
GETTING
STARTED
The book
The course is
based on the book "Programming Languages: Application and
Interpretation" by S.
Krishnamurthi from Brown University.
The book is
free, available in pdf format at: http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/
The
environment
* DrScheme: http://drscheme.org
* Once DrScheme installed, run it, File > Install .plt file and
enter the URL: http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/plai-350.plt
* Restart
DrScheme, then Language > Choose
Language.., and select the "PLAI - Advanced Student" teaching language.
The interaction
window of DrScheme should say:
Welcome to
DrScheme, version 360.
Language:
PLAI - Advanced Student.
Test your
installation
To
check whether everything is ok, copy-paste the following code in the
definition window:
;; Arithmetic
Expression data type
(define-type
AE
[num
(n number?)]
[add
(lhs AE?)
(rhs AE?)]
[sub
(lhs AE?)
(rhs AE?)])
;; parse :
sexp -> AE
;; to convert
s-expressions into AEs
(define
(parse sexp)
(cond
[(number? sexp) (num sexp)]
[(list? sexp)
(case (first sexp)
[(+) (add (parse(second sexp))
(parse(third sexp)))]
[(-) (sub (parse(second sexp))
(parse(third sexp)))])]))
;; a parse
test case
(test (parse
'3) (num 3))
Then
click on the Run button. The output in the interaction window should be:
Welcome to
DrScheme, version 352.
Language:
PLAI - Advanced Student.
(list 'good
(num 3) (num 3))
>
You're
now ready!
Libro sobre Scheme
Teach yourself Scheme in Fixnum Days, by
Dorai Sitaram.
Clases Auxiliares
pautas
Controles
control1.pdf
control2.pdf