https://github.com/degory/ghul
compiler for the ghūl programming language
https://github.com/degory/ghul
compiler dotnet dotnet-core ghul programming-language
Last synced: 16 days ago
JSON representation
compiler for the ghūl programming language
- Host: GitHub
- URL: https://github.com/degory/ghul
- Owner: degory
- License: agpl-3.0
- Created: 2017-06-21T15:39:36.000Z (about 9 years ago)
- Default Branch: main
- Last Pushed: 2026-06-12T19:22:26.000Z (18 days ago)
- Last Synced: 2026-06-12T19:23:57.481Z (18 days ago)
- Topics: compiler, dotnet, dotnet-core, ghul, programming-language
- Language: Shell
- Homepage: https://ghul.dev
- Size: 16.2 MB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 31
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Agents: AGENTS.md
Awesome Lists containing this project
README
# ghūl compiler
[](https://github.com/degory/ghul/actions?query=workflow%3ACI)
[](https://www.nuget.org/packages/ghul.compiler/)
[](https://github.com/degory/ghul/releases)
[](https://github.com/degory/ghul/releases)
[](https://github.com/degory/ghul/issues)
[](https://github.com/degory/ghul/blob/main/LICENSE)
[](https://ghul.dev)
This is the compiler for the [ghūl programming language](https://ghul.dev). It is a [self-hosting compiler](https://en.wikipedia.org/wiki/Self-hosting_(compilers)): the compiler itself is written entirely in ghūl.

## Prerequisites
The compiler requires the [.NET 8.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
## 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](https://www.nuget.org/packages/ghul.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](https://github.com/degory/ghul-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.
### Install the compiler as a local or global .NET tool
You can manually install the compiler from the [ghūl compiler .NET tool package](https://www.nuget.org/packages/ghul.compiler/)
## Using the compiler
### Project file
The compiler expects to be driven by MSBuild using a `.ghulproj` project file.
See the [ghūl test](https://github.com/degory/ghul-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:
```sh
dotnet build
```
```sh
dotnet pack
```
```sh
dotnet run
```
### Runtime dependencies for ghūl applications
Applications written in ghūl require the [.NET 8.0](https://dotnet.microsoft.com/download/dotnet/8.0) runtime
## Development environment
### Visual Studio Code
[Visual Studio Code](https://code.visualstudio.com) will give you rich language support via the [ghūl VSCode language extension](https://marketplace.visualstudio.com/items?itemName=degory.ghul).
### Dev container
Any dev container image with the .NET 8 SDK will do — for example [`mcr.microsoft.com/devcontainers/dotnet:8.0`](https://hub.docker.com/r/microsoft/devcontainers-dotnet). Pin `ghul.compiler` in your project's local .NET tool manifest and the compiler will be restored automatically when the container starts. A minimal worked example is in [this gist](https://gist.github.com/degory/1d6894fe1cf0bf73bb75cbf9c9176a0a).
## Basic ghūl language tutorial
For a short ghūl programming language tutorial and reference, see [GHUL.md](./GHUL.md) in this repository. For more ghūl language details, see the [the ghūl programming language website](https://ghul.dev)
## Gotchas
The ghūl language is sufficiently expressive and the compiler is stable enough for the compiler itself to be written in ghūl. Like any compiler it has [bugs](https://github.com/degory/ghul/issues?q=is%3Aissue+is%3Aopen+label%3Abug) — issue reports are welcome.