Skip to main content

A compiler for burb lang.

Project description

License: MIT

BLang - A Minimal Programming Language

This is a toy programming language with its own compiler backend that emits x86_64 assembly. It supports basic types, arrays, pointers, functions, conditionals, loops, etc. The compiler is written in Python.

Why?

Just for fun. I wanted to learn how compilers work at a deeper level, and this was a great way to explore parsing, code generation, memory layout, calling conventions, etc.

Is it useful?

Probably not. It's not fast, it's not safe, it's not feature-complete, and it doesn't have a standard library. But the code is (mostly) readable, and it covers a lot of core ideas behind compiling a high-level language down to raw machine code.

Running

Install NASM.

To compile a .bl source file to a native executable:

blangc your_program.bl -o your_program

To run tests:

pytest tests/

Current Features

  • Integers (signed/unsigned), doubles
  • Arrays and pointers
  • Functions (multiple arguments, stack handling)
  • Conditionals (if, else)
  • Loops (while, for)
  • Bitwise operations (&, |, ^)
  • String literals and basic string handling
  • Assembly output using NASM
  • Simple CLI compiler
  • CI build and test pipeline

Missing / Incomplete / Won't Do

  • No type inference or advanced type checking
  • No heap allocation or garbage collection
  • No standard library
  • Limited error reporting
  • No optimization passes
  • No inline assembly or macros (yet)
  • No structs

License

MIT

Example programs

See examples/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blang-0.1.2.tar.gz (45.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

blang-0.1.2-py3-none-any.whl (27.5 kB view details)

Uploaded Python 3

File details

Details for the file blang-0.1.2.tar.gz.

File metadata

  • Download URL: blang-0.1.2.tar.gz
  • Upload date:
  • Size: 45.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.3

File hashes

Hashes for blang-0.1.2.tar.gz
Algorithm Hash digest
SHA256 fdd2f24e86ea7e312de71cf38f535f1d9a7c23d0b87dfd0c0428e536f4274653
MD5 616a05e66dd439cee575501c2959e52a
BLAKE2b-256 c3561568952fee8ede69d1e9732a4f4328cbd5ef0275fa49f817ca4f30de04d2

See more details on using hashes here.

File details

Details for the file blang-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: blang-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 27.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.3

File hashes

Hashes for blang-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c3086479193350fb6ca12fb9c67913c224962d4e4f9193b9b34cc0a53edcf19b
MD5 f22aa03cedc0018fb5b881c981c9eb8b
BLAKE2b-256 dbb97cd2d4c39134448d90dcd23bc7d274ac763efea7a9aa4c75bdea46742944

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page