🆉🅽 - The Znutar programming language
Znutar is a hobby language for the .NET platform. I created it because I wanted to learn about:
- Hindley–Milner type inference.
- Creating a new .NET language from scratch.
Znutar is a functional programming language that can also call methods in external .NET libraries:
System.Console.WriteLine("Hello world")
Here's how to implement factorial:
- Create a
Factorial.znfile containing the source code of your program:
let rec factorial n =
if n = 0 then 1
else n * factorial (n - 1);
System.Console.WriteLine(factorial 6)
- In the same directory, create a
Factorial.znprojfile that looks like this:
<Project Sdk="Znutar.Sdk/1.0.0">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Factorial.zn" />
</ItemGroup>
</Project>
- Compile your program:
dotnet build. - Run your program:
.\bin\Debug\net7.0\Factorial.exe. Output is720.
- Provide an alternative to F#.
- Explore the possibility of type classes, higher-kinded types, and other functional programming concepts.
- Self-host the Znutar compiler. (It's currently written in F#.)