-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
116 additions
and
80 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,23 @@ | ||
NanoML is a simple eager functional programming language based on [MiniML](http://www.andrej.com/plzoo/html/miniml.html) from [The Programming Language Zoo](http://www.andrej.com/plzoo/) | ||
|
||
NanoML written on [_F#_](http://en.wikipedia.org/wiki/F_Sharp_%28programming_language%29). Lexing and parsing done by fslex and fsyacc. Runtime is a simple [SECD virtual machine](http://en.wikipedia.org/wiki/SECD_machine). | ||
|
||
NanoML has 4 types _int_, _float_, _bool_, (* -> *). Language hasn't type inference at all. But type checker statically check all types in program. | ||
|
||
Language support functions, values, recursion, closures. | ||
|
||
Also language provides with simple interpreter shell. | ||
|
||
Below is a classical example recursive factorial function: | ||
|
||
let fact = | ||
fun f (n : int) : int => | ||
if n = 0 then 1 | ||
else n * f (n - 1) | ||
end;; | ||
|
||
|
||
|
||
To see more NanoML code check _stdlib.nanoml_ which contains small set of common and useful functions. | ||
|
||
To get full language syntax see _NanoMLParser.fsy_. |
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 |
---|---|---|
@@ -1,4 +1,10 @@ | ||
call compile-lexer.cmd | ||
call compile-parser.cmd | ||
|
||
fsc ../src/NanoML/List.fs ../src/NanoML/NanoMLAst.fs ../src/NanoML/TypeChecker.fs ../src/NanoML/NanoMLParser.fs ../src/NanoML/NanoMLLexer.fs ../src/NanoML/VM.fs ../src/NanoML/Compile.fs ../src/NanoML/NanoML.fs -r FSharp.Powerpack.dll | ||
set original_dir=%cd% | ||
|
||
cd ../src/NanoML | ||
|
||
fsc List.fs NanoMLAst.fs NanoMLTAst.fs TypeChecker.fs NanoMLParser.fs NanoMLLexer.fs VM.fs NanoMLLang.fs Compile.fs NanoML.fs -r ../../lib/FSharp.Powerpack.dll | ||
|
||
cd %original_dir% |
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
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