-
Notifications
You must be signed in to change notification settings - Fork 2.7k
MAL implementation in Modula-2. #731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zawaza-blog
wants to merge
6
commits into
kanaka:master
Choose a base branch
from
zawaza-blog:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
18e5172
MAL implementation in Modula-2.
zawaza-blog 6c401fc
Alignment with Commit 2bbfaa5. Use /usr/bin/env bash shebangs instead…
zawaza-blog 6675075
modula2: Added modula2 to the IMPLS.yml so that the automated CI will…
zawaza-blog 79125d1
modula2: fixes for self-hosted tests.
zawaza-blog 82f692f
modula2: reverted default implementation to js in impls/mal/run.
zawaza-blog bb9f8c6
modula2: align macroexpand with current description in step8.
zawaza-blog File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,103 @@ | ||
| DEFINITION MODULE Core; | ||
|
|
||
| (* MAL Core Functions - Definition Module *) | ||
|
|
||
| FROM Types IMPORT MalVal; | ||
| FROM Env IMPORT Env; | ||
|
|
||
| (* Evaluator procedure type - for passing EVAL to Core *) | ||
| TYPE | ||
| EvalProc = PROCEDURE(MalVal, Env): MalVal; | ||
|
|
||
| (* Arithmetic operations *) | ||
| PROCEDURE Add(args: MalVal): MalVal; | ||
| PROCEDURE Sub(args: MalVal): MalVal; | ||
| PROCEDURE Mul(args: MalVal): MalVal; | ||
| PROCEDURE Div(args: MalVal): MalVal; | ||
|
|
||
| (* Comparison operations *) | ||
| PROCEDURE Equal(args: MalVal): MalVal; | ||
| PROCEDURE LessThan(args: MalVal): MalVal; | ||
| PROCEDURE LessThanOrEqual(args: MalVal): MalVal; | ||
| PROCEDURE GreaterThan(args: MalVal): MalVal; | ||
| PROCEDURE GreaterThanOrEqual(args: MalVal): MalVal; | ||
|
|
||
| (* Logical operations *) | ||
| PROCEDURE NotFn(args: MalVal): MalVal; | ||
|
|
||
| (* List operations *) | ||
| PROCEDURE MakeList(args: MalVal): MalVal; | ||
| PROCEDURE MakeVector(args: MalVal): MalVal; | ||
| PROCEDURE MakeHashMap(args: MalVal): MalVal; | ||
| PROCEDURE NormalizeHashMap(hmap: MalVal): MalVal; | ||
| PROCEDURE GetFn(args: MalVal): MalVal; | ||
| PROCEDURE AssocFn(args: MalVal): MalVal; | ||
| PROCEDURE ContainsFn(args: MalVal): MalVal; | ||
| PROCEDURE DissocFn(args: MalVal): MalVal; | ||
| PROCEDURE KeysFn(args: MalVal): MalVal; | ||
| PROCEDURE ValsFn(args: MalVal): MalVal; | ||
| PROCEDURE IsListFn(args: MalVal): MalVal; | ||
| PROCEDURE IsEmptyFn(args: MalVal): MalVal; | ||
| PROCEDURE CountFn(args: MalVal): MalVal; | ||
| PROCEDURE ConsFn(args: MalVal): MalVal; | ||
| PROCEDURE ConcatFn(args: MalVal): MalVal; | ||
| PROCEDURE VecFn(args: MalVal): MalVal; | ||
| PROCEDURE NthFn(args: MalVal): MalVal; | ||
| PROCEDURE FirstFn(args: MalVal): MalVal; | ||
| PROCEDURE RestFn(args: MalVal): MalVal; | ||
|
|
||
| (* Quasiquote support *) | ||
| PROCEDURE Quasiquote(ast: MalVal): MalVal; | ||
|
|
||
| (* Atom operations *) | ||
| PROCEDURE AtomFn(args: MalVal): MalVal; | ||
| PROCEDURE IsAtomFn(args: MalVal): MalVal; | ||
| PROCEDURE DerefFn(args: MalVal): MalVal; | ||
| PROCEDURE ResetFn(args: MalVal): MalVal; | ||
| PROCEDURE SwapFn(args: MalVal): MalVal; | ||
|
|
||
| (* Macro operations *) | ||
| PROCEDURE IsMacroFn(args: MalVal): MalVal; | ||
|
|
||
| (* Exception operations *) | ||
| PROCEDURE ThrowFn(args: MalVal): MalVal; | ||
|
|
||
| (* Type predicates *) | ||
| PROCEDURE NilPredFn(args: MalVal): MalVal; | ||
| PROCEDURE TruePredFn(args: MalVal): MalVal; | ||
| PROCEDURE FalsePredFn(args: MalVal): MalVal; | ||
| PROCEDURE SymbolPredFn(args: MalVal): MalVal; | ||
| PROCEDURE KeywordPredFn(args: MalVal): MalVal; | ||
| PROCEDURE SequentialPredFn(args: MalVal): MalVal; | ||
| PROCEDURE VectorPredFn(args: MalVal): MalVal; | ||
| PROCEDURE MapPredFn(args: MalVal): MalVal; | ||
|
|
||
| (* Symbol and keyword constructors *) | ||
| PROCEDURE SymbolFn(args: MalVal): MalVal; | ||
| PROCEDURE KeywordFn(args: MalVal): MalVal; | ||
|
|
||
| (* Functional programming *) | ||
| PROCEDURE ApplyFn(args: MalVal): MalVal; | ||
| PROCEDURE MapFn(args: MalVal): MalVal; | ||
|
|
||
| (* Function parameter binding *) | ||
| PROCEDURE BindFunctionParams(params: MalVal; args: MalVal; env: Env): BOOLEAN; | ||
|
|
||
| (* String/IO operations *) | ||
| PROCEDURE ReadStringFn(args: MalVal): MalVal; | ||
| PROCEDURE SlurpFn(args: MalVal): MalVal; | ||
|
|
||
| (* Evaluation *) | ||
| PROCEDURE EvalFn(args: MalVal): MalVal; | ||
|
|
||
| (* Printing operations *) | ||
| PROCEDURE PrStrFn(args: MalVal): MalVal; | ||
| PROCEDURE StrFn(args: MalVal): MalVal; | ||
| PROCEDURE PrnFn(args: MalVal): MalVal; | ||
| PROCEDURE PrintlnFn(args: MalVal): MalVal; | ||
|
|
||
| (* REPL environment initialization *) | ||
| PROCEDURE SetEvaluator(evalProc: EvalProc); | ||
| PROCEDURE InitReplEnv(argc: CARDINAL): Env; | ||
|
|
||
| END Core. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you accidentally changed the mal run script to use modula2 by default. You shouldn't need to do this. If you run
make MAL_IMPL=modula2 test^malthat should run the tests is self-host mode using the modula2 implementation as the host implementation. The "js" here is just the fallback if you don't specify MAL_IMPL.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ops. Sorry. default MAL_IMPL has been reverted to "js".
Thanks again for your time and dedication. 😃