# PLT DrScheme: Advanced Student Language

- PROGRAM
  - DEF-EXP ...
- DEF-EXP
  - DEFINITION
  - EXPRESSION
- DEFINITION
  - `(define (NAME NAME ...) EXPRESSION)`
  - `(define-struct NAME (NAME ...))`
  - `(define-struct (NAME NAME) (NAME ...))`
  - `(define NAME EXPRESSION)`
- EXPRESSION
  - `(begin EXPRESSION EXPRESSION ...)`
  - `(begin EXPRESSION EXPRESSION ...)`
  - `(set! NAME EXPRESSION)`
  - `(delay EXPRESSION)`
  - `(recur NAME ((NAME EXPRESSION) ...) EXPRESSION)`
  - `(local (DEFINITION ...) EXPRESSION)`
  - `(letrec ((NAME EXPRESSION) ...) EXPRESSION)`
  - `(let ((NAME EXPRESSION) ...) EXPRESSION)`
  - `(let NAME ((NAME EXPRESSION) ...) EXPRESSION)`
  - `(EXPRESSION EXPRESSION ...)`
  - `(lambda (NAME ...) EXPRESSION)`
  - `(PRIM-OP EXPRESSION ...)`
  - `(cond (EXPRESSION EXPRESSION) (EXPRESSION EXPRESSION) ...)`
  - `(cond (EXPRESSION EXPRESSION) ... (else EXPRESSION))`
  - `(if EXPRESSION EXPRESSION EXPRESSION)`
  - `(and EXPRESSION EXPRESSION EXPRESSION ...)`
  - `(or EXPRESSION EXPRESSION EXPRESSION ...)`
  - `empty`
  - `NAME`
  - `'TAG`
  - NUMBER
  - `true`
  - `false`
  - STRING
  - CHARACTER
- NAME
  - a sequence of keyboard-characters not including: space " , ' ` ( ) [ ] { } | ;
- PRIM-OPS
  - Numbers: Integers, Rationals, Reals, Complex, Exacts, Inexacts
    - `number?` : `(any -> boolean)`
    - `=` : `(num num num ... -> boolean)`
    - `<` : `(real real real ... -> boolean)`
    - `>` : `(real real real ... -> boolean)`
    - `<=` : `(real real real ... -> boolean)`
    - `>=` : `(real real -> boolean)`
    - `+` : `(num num num ... -> num)`
    - `-` : `(num num ... -> num)`
    - `*` : `(num num num ... -> num)`
    - `/` : `(num num num ... -> num)`
    - `max` : `(num num ... -> num)`
    - `min` : `(num num ... -> num)`
    - `quotient` : `(int int -> int)`
    - `remainder` : `(int int -> int)`
    - `modulo` : `(int int -> int)`
    - `square` : `(num -> num)`
    - `sqrt` : `(num -> num)`
    - `expt` : `(num num -> num)`
    - `abs` : `(real -> real)`
    - `exp` : `(num -> num)`
    - `log` : `(num -> num)`
    - `sin` : `(num -> num)`
    - `cos` : `(num -> num)`
    - `tan` : `(num -> num)`
    - `asin` : `(num -> num)`
    - `acos` : `(num -> num)`
    - `atan` : `(num -> num)`
    - `sinh` : `(num -> num)`
    - `cosh` : `(num -> num)`
    - `exact?` : `(num -> bool)`
    - `integer?` : `(any -> bool)`
    - `zero?` : `(number -> bool)`
    - `odd?` : `(integer -> bool)`
    - `even?` : `(integer -> bool)`
    - `add1` : `(number -> number)`
    - `sub1` : `(number -> number)`
    - `lcm` : `(int int ... -> int)`
    - `gcd` : `(int int ... -> int)`
    - `rational?` : `(any -> bool)`
    - `numerator` : `(rat -> int)`
    - `denominator` : `(rat -> int)`
    - `inexact?` : `(num -> bool)`
    - `real?` : `(any -> bool)`
    - `floor` : `(real -> int)`
    - `ceiling` : `(real -> int)`
    - `round` : `(real -> int)`
    - `complex?` : `(any -> bool)`
    - `make-polar` : `(real real -> num)`
    - `real-part` : `(num -> real)`
    - `imag-part` : `(num -> real)`
    - `magnitude` : `(num -> real)`
    - `angle` : `(num -> real)`
    - `conjugate` : `(num -> num)`
    - `exact->inexact` : `(num -> num)`
    - `inexact->exact` : `(num -> num)`
    - `number->string` : `(num -> string)`
    - `integer->char` : `(int -> char)`
    - `random` : `(int -> int)`
    - `current-seconds` : `(-> int)`
    - `e` : `real`
    - `pi` : `real`
  - Booleans
    - `boolean?` : `(any -> boolean)`
    - `boolean=?` : `(boolean boolean -> boolean)`
    - `not` : `(boolean -> boolean)`
  - Symbols
    - `symbol?` : `(any -> boolean)`
    - `symbol=?` : `(symbol symbol -> boolean)`
  - Lists
    - `cons?` : `(any -> boolean)`
    - `pair?` : `(any -> boolean)`
    - `empty?` : `(any -> boolean)`
    - `null?` : `(any -> boolean)`
    - `list?` : `(any -> boolean)`
    - `cons` : `(x (listof x) -> (listof x))`
    - `first` : `((cons y (listof x)) -> y)`
    - `car` : `((cons y (listof x)) -> y)`
    - `rest` : `((cons y (listof x)) -> (listof x))`
    - `cdr` : `((cons y (listof x)) -> (listof x))`
    - `second` : `((cons z (cons y (listof x))) -> y)`
    - `third` : `((cons w (cons z (cons y (listof x)))) -> y)`
    - `fourth` : `((listof y) -> y)`
    - `fifth` : `((listof y) -> y)`
    - `sixth` : `((listof y) -> y)`
    - `seventh` : `((listof y) -> y)`
    - `eighth` : `((listof y) -> y)`
    - `list-ref` : `((listof x) number -> x)`
    - `list` : `(any ... -> (listof any))`
    - `append` : `((listof any) ... -> (listof any))`
    - `length` : `(list -> number)`
    - `memq` : `(any list -> (union false list))`
    - `reverse` : `(list -> list)`
    - `assq` : `(x (listof (cons x y)) -> (union false (cons x y)))`
    - `equal?` : `(list list -> boolean)`
  - Characters
    - `char?` : `(any -> boolean)`
    - `char=?` : `(char char ... -> boolean)`
    - `char<?` : `(char char ... -> boolean)`
    - `char>?` : `(char char ... -> boolean)`
    - `char<=?` : `(char char ... -> boolean)`
    - `char>=?` : `(char char ... -> boolean)`
    - `char-ci=?` : `(char char ... -> boolean)`
    - `char-ci<?` : `(char char ... -> boolean)`
    - `char-ci>?` : `(char char ... -> boolean)`
    - `char-ci<=?` : `(char char ... -> boolean)`
    - `char-ci>=?` : `(char char ... -> boolean)`
    - `char-numeric?` : `(char -> boolean)`
    - `char-alphabetic?` : `(char -> boolean)`
    - `char-whitespace?` : `(char -> boolean)`
    - `char-upper-case?` : `(char -> boolean)`
    - `char-lower-case?` : `(char -> boolean)`
    - `char-upcase` : `(char -> char)`
    - `char-downcase` : `(char -> char)`
    - `char->integer` : `(char -> integer)`
  - Strings
    - `string?` : `(any -> boolean)`
    - `string-length` : `(string -> nat)`
    - `make-string` : `(nat char -> string)`
    - `string-ref` : `(string nat -> char)`
    - `substring` : `(string nat nat -> string)`
    - `string-copy` : `(string -> string)`
    - `string-append` : `(string ... -> string)`
    - `string=?` : `(string string ... -> boolean)`
    - `string<?` : `(string string ... -> boolean)`
    - `string>?` : `(string string ... -> boolean)`
    - `string<=?` : `(string string ... -> boolean)`
    - `string>=?` : `(string string ... -> boolean)`
    - `string-ci=?` : `(string string ... -> boolean)`
    - `string-ci<?` : `(string string ... -> boolean)`
    - `string-ci>?` : `(string string ... -> boolean)`
    - `string-ci<=?` : `(string string ... -> boolean)`
    - `string-ci>=?` : `(string string ... -> boolean)`
    - `string->number` : `(string -> (union number false))`
    - `string->list` : `(string -> (listof char))`
    - `list->string` : `((listof char) -> string)`
    - `format` : `(string any ... -> string)`
  - Posns
    - `make-posn` : `(number number -> posn)`
    - `posn?` : `(anything -> boolean)`
    - `posn-x` : `(posn -> number)`
    - `posn-y` : `(posn -> number)`
    - `set-posn-x!` : `(posn number -> void)`
    - `set-posn-y!` : `(posn number -> void)`
  - Misc
    - `error` : `(symbol string -> void)`
    - `struct?` : `(any -> boolean)`
    - `equal?` : `(any any -> boolean)`
    - `eq?` : `(any any -> boolean)`
    - `exit` : `(-> void)`
    - `eval` : `(any -> any)`
    - `procedure?` : `(any -> boolean)`
    - `time-apply` : `((any ... -> any) any ... -> any)`
    - `apply` : `((any ... -> any) any ... -> any)`
    - `values` : `(any ... -> (values any ...))`
    - `printf` : `(string any ... -> void)`
    - `void` : `(-> void)`
    - `void?` : `(any -> boolean)`
    - `raise` : `(any -> void)`
    - `make-exn:else` : `(string continuation-mark-set -> exn)`
    - `current-continuation-marks` : `(-> continuation-mark-set)`
    - `force` : `(delay -> any)`
    - `promise?` : `(any -> boolean)`
    - `make-promise` : `((-> any) -> boolean)`
  - Vectors
    - `vector` : `(any ... -> vector)`
    - `make-vector` : `(number any -> vector)`
    - `vector-ref` : `(vector number -> any)`
    - `vector-set!` : `(vector number any -> void)`
    - `vector?` : `(any -> boolean)`
  - Boxes
    - `box` : `(any -> box)`
    - `unbox` : `(box -> any)`
    - `set-box!` : `(box any -> void)`
    - `box?` : `(any -> boolean)`
  - Continuations
    - `call/cc` : `((cont -> any) -> any)`
    - `call-with-current-continuation` : `((cont -> any) -> any)`

Generic Errors
- Out of Context Keywords
- Empty Combination
- Expected an identifier
- Repeated Identifier
- Invalid Identifier
- Cannot Bind Keywords
- Reading Syntax Error
- Scanning Syntax Error

Undocumented Forms
- struct
- nor
- nand
- case-lambda
- define-values
- require-library
- require-relative-library
- reference-file
- polymorphic
- mrspidey:control
- :
- type:
- define-type
- define-constructor
- define-macro
- let-macro
- quote
- quasiquote
- unquote
- unquote-splicing
- let-struct
- let*
- let-values
- let*-values
- letrec-values
- rec
- case
- evcase
- when
- unless
- let/cc
- let/ec
- do
- fluid-let
- parameterize
- with-handlers
- set!-values