Skip to content

Compiler for my own programming language (in progress...)

Notifications You must be signed in to change notification settings

mohammedhrima/Wolf-Compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wolf-C Compiler

  • still under development
  • Welcome to Wolf-C, a lightweight compiler with a syntax inspired by Python and C.

How to Use (for now)

Step 1: Build the Compiler

  1. Run make to create a Docker container.
  2. Use docker ps to find the container ID of the running project.
  3. Access the container using the command:
    docker exec -it wcc bash

Step 2: Compile Your Code

  • modify file.w inside the code directory.
  • Run the build command to compile your file:
    wcc file.w

Features:

  1. Print Something:
    main():
        chars str = "user"
        output("Hello, world! from ", user, "\n")
  1. Variables and Data Types:
    main():
        chars name = "Alice"      // string
        int age = 25              // integer
        float height = 5.6        // float
        bool is_student = True    // boolean
        output(name, age, height, is_student)
  1. If Statements:
    main():
        int age = 18
        if age >= 18: output("You're an adult!\n")
        else: output("You're a minor.\n")
  1. Loops:
    main():
        int count = 0
        while count < 3:
            output("Counting:", count, "\n")
            count += 1
  1. Functions:
    func int greet(chars name):
        output("Hello, ", name, "\n")
        return 42

    main():
        greet("Alice")
  1. Structs:
    struct Person:
        chars name
        int age
    
    main():
        Person user
        user.name = "mohammed"
        user.age = 27
  1. import files:
use config      // will import ./config.w
use :config     // will import /config.w
usr :src:config // will import /src/config