This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Group is | |
tiger.lex | |
errormsg.sml | |
parsetest.sml | |
tiger.grm | |
smlnj-lib.cm | |
ml-yacc-lib.cm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
signature ERRORMSG = | |
sig | |
val anyErrors : bool ref | |
val fileName : string ref | |
val lineNum : int ref | |
val linePos : int list ref | |
val sourceStream : TextIO.instream ref | |
val error : int -> string -> unit | |
exception Error | |
val impossible : string -> 'a (* raises Error *) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define-syntax (define-ustruct stx) | |
(define (make-updater-name struct-name field-name) | |
(symbol-append struct-name '-update- field-name)) | |
(define (make-updater-proc name-stx field-stx) | |
(let* ((field-name (syntax->datum field-stx)) | |
(struct-name (syntax->datum name-stx)) | |
(update-proc (datum->syntax name-stx | |
(make-updater-name struct-name | |
field-name)))) | |
#`(define (#,update-proc s val) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define-syntax symbol-append | |
(syntax-rules () | |
[(_ sym ...) | |
(string->symbol (string-append (symbol->string sym) ...))])) | |
(define-syntax (define-ustruct stx) | |
(define (make-updater-name struct-name field-name) | |
;; How do I get symbol-append to be defined here? | |
(symbol-append struct-name '-update- field-name)) | |
(define (make-updater-proc name-stx field-stx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- Data stack: | |
1 | |
2 | |
3 | |
4 | |
5 | |
( scratchpad ) [| :> a | a ] call | |
--- Data stack: | |
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
danking@danking-desktop:~ 18:31 $ racket | |
Welcome to Racket v5.1. | |
> (require ffi/unsafe) | |
> ((get-ffi-obj "execv" #f (_fun _path (_list i _string) -> _int)) "/bin/ls" '("/bin/ls")) | |
-1 | |
> "test" | |
"test" | |
> | |
danking@danking-desktop:~ 18:32 $ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GADTs, FlexibleInstances #-} | |
data Stack a where | |
Empty :: () -> Stack () | |
Push :: b -> Stack a -> Stack (b,Stack a) | |
instance Show (Stack ()) where | |
show (Empty ()) = "()" | |
instance (Show a, Show b) => Show (Stack (a,b)) where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deref ::= id LBRACK num RBRACK | |
| id DOT id | |
| id DOT foo | |
id . LBRACK num RBRACK | |
id . DOT id | |
id . DOT foo | |
id DOT . id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Grammar | |
0 $accept: foo $end | |
1 foo: foo A | |
2 | A | |
Terminals, with rules where they appear |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Grammar | |
0 $accept: foo $end | |
1 foo: foo A | |
2 | A | |
Terminals, with rules where they appear |