degory / ghul

compiler for the ghūl programming language
https://ghul.dev
GNU Affero General Public License v3.0
4 stars 0 forks source link
compiler dotnet dotnet-core ghul programming-language

ghūl compiler

CI/CD NuGet version (ghul) Release Release Date Issues License ghūl

This is the compiler for the ghūl programming language. It is a self-hosting compiler: the compiler itself is written entirely in ghūl.

ghūl logo icon small

Prerequisites

The compiler requires the .NET 8.0 SDK

Target

The compiler produces standard .NET assemblies and packages targeting .NET 8.0

Getting the compiler

There are a few different ways to get the compiler

Use a ghūl .NET project template

If you initialize your project using one of the ghūl .NET project templates, the template will add the compiler to your project folder as a local .NET tool - just run dotnet tool restore to restore it.

Clone the ghūl GitHub repository template

If you create a new GitHub repo from the ghūl repository template, then the compiler will be pre-configured as a local .NET tool in your project folder - run dotnet tool restore to restore it.

Use the ghūl development container image

The compiler is pre-installed globally in the ghūl development container

Install the compiler as a local or global .NET tool

You can manually install the compiler from the ghūl compiler .NET tool package

Using the compiler

Project file

The compiler expects to be driven by MSBuild using a .ghulproj project file. See the ghūl test project for a real-world example, or use one of the project templates to get started.

Source files

You'll need some ghūl source files. By convention ghūl source files have the extension .ghul, and the standard MSBuild targets will include **/*.ghul when building.

Building and running

Once you have a project file and some ghūl source files, you can use the normal .NET SDK commands to build, pack, and run your project:

dotnet build
dotnet pack
dotnet run

Runtime dependencies for ghūl applications

Applications written in ghūl require the .NET 8.0 runtime

Development environment

Visual Studio Code will give you rich language support via the ghūl VSCode language extension.

Gotchas

The ghūl language is sufficiently expressive and the compiler is stable enough for the compiler itself to be written in ghūl. However, this is an incomplete compiler for an experimental programming language: there will be compiler bugs!