Minsk.Compiler
0.2.0-preview7
This is a prerelease version of Minsk.Compiler.
dotnet add package Minsk.Compiler --version 0.2.0-preview7
NuGet\Install-Package Minsk.Compiler -Version 0.2.0-preview7
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Minsk.Compiler" Version="0.2.0-preview7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Minsk.Compiler --version 0.2.0-preview7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Minsk.Compiler, 0.2.0-preview7"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Minsk.Compiler as a Cake Addin
#addin nuget:?package=Minsk.Compiler&version=0.2.0-preview7&prerelease
// Install Minsk.Compiler as a Cake Tool
#tool nuget:?package=Minsk.Compiler&version=0.2.0-preview7&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Minsk [http://minsk-compiler.net]
Building a compiler
This repo contains Minsk, a handwritten compiler in C#. It illustrates basic concepts of compiler construction and how one can tool the language inside of an IDE by exposing APIs for parsing and type checking. This compiler uses many of the concepts that you can find in the Microsoft C# and Visual Basic compilers, code named Roslyn.
1. Expression evaluator
- Basic REPL (read-eval-print loop) for an expression evaluator
- Added lexer, a parser, and an evaluator
- Handle
+
,-
,*
,/
, and parenthesized expressions - Print syntax trees
2. More operators and literals
- Generalized parsing using precedences
- Support unary operators, such as
+2
and-3
- Support for Boolean literals (
false
,true
) - Support for conditions such as
1 == 3 && 2 != 3 || true
- Internal representation for type checking (
Binder
, andBoundNode
)
3. Assignments and variables
- Extracted compiler into a separate library
- Exposed span on diagnostics that indicate where the error occurred
- Support for assignments and variables
4. Add tests
- Added tests for lexing all tokens and their combinations
- Added tests for parsing unary and binary operators
- Added tests for evaluating
- Added test execution to our CI
5. Line numbers and clean-up
- Code clean-up
- Added
SourceText
, which allows to compute line number information
6. Line numbers and clean-up
- Added colorization to REPL
- Added compilation unit
- Added chaining to compilations
- Added statements
- Added variable declaration statements
7. Declarative tests, if-, while-, and for-statements
- Made evaluation tests more declarative, especially for diagnostics
- Added support for
<,
<=
,>=
, and>
- Added support for if-statements
- Added support for while-statements
- Added support for for-statements
- Ensure parser doesn't loop infinitely on malformed block
- Ensure binder doesn't crash when binding fabricated identifiers
8. Lowering
- Add support for bitwise operators
- Add ability to output the bound tree
- Add ability to lower bound tree
- Lower
for
-statements intowhile
-statements - Print syntax and bound tree before evaluation
- Lower
if
,while
, andfor
into gotos
9. A better REPL
- Add REPL ability to edit multiple lines, have history and syntax highlighting
10. String literals and type symbols
- Added support for string literals and type symbols
11. Function calls
- Added support for calling built-in functions and convert between types
12. Declaring functions
- Added support for explicit typing of variables and function declarations
13. Declaring functions
- Added pretty printing for bound nodes as well as
break
andcontinue
statements
14. Return statements and control flow analysis
- Added support for return statements and control flow analysis.
[ ... ]
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- System.Collections.Immutable (>= 6.0.0)
- System.ValueTuple (>= 4.5.0)
-
net6.0
- System.Collections.Immutable (>= 6.0.0)
- System.ValueTuple (>= 4.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.2.0-preview7 | 133 | 4/20/2022 |
0.2.0-preview6 | 113 | 4/20/2022 |
0.2.0-preview5 | 107 | 4/20/2022 |
0.2.0-preview4 | 113 | 4/20/2022 |
0.2.0-preview3 | 112 | 4/17/2022 |
0.2.0-preview2 | 118 | 4/16/2022 |
0.2.0-preview1 | 154 | 4/16/2022 |