-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove RESUME_CONT instruction from active CSE machine instructions * Remove GENERATE_CONT instruction from active CSE machine instructions * Remove all trace of GENERATE_CONT and RESUME_CONT * Remove unnecessary types and imports * Make the implementation of continuations cleaner * Change representation of call/cc * Add test file for call/cc * Improve testing for continuations
- Loading branch information
Kyriel Abad
authored
Jul 18, 2024
1 parent
f4adb13
commit e4e4631
Showing
6 changed files
with
119 additions
and
140 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Call_cc, Continuation, isCallWithCurrentContinuation } from '../continuations' | ||
import { Control, Stash } from '../interpreter' | ||
|
||
test('call/cc is a singleton', () => { | ||
expect(Call_cc.get()).toBe(Call_cc.get()) | ||
}) | ||
|
||
test('call/cc toString', () => { | ||
expect(Call_cc.get().toString()).toBe('call/cc') | ||
}) | ||
|
||
test('isCallWithCurrentContinuation works on call/cc only', () => { | ||
expect(isCallWithCurrentContinuation(Call_cc.get())).toBe(true) | ||
expect(isCallWithCurrentContinuation(1)).toBe(false) | ||
}) | ||
|
||
test('Continuation toString', () => { | ||
const cont = new Continuation(new Control(), new Stash(), []) | ||
expect(cont.toString()).toBe('continuation') | ||
}) |
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
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
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
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
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