Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

DogLang Programming Language

🐕 Welcome to DogLang!

DogLang is a fun, interpreted programming language I created with syntax inspired by our canine friends. With keywords like bark for printing, wagtail for loops, and sniff for conditionals, it brings a playful approach to coding.

🚀 Join the Pack!

This is an open-source hobby project that welcomes contributors of all experience levels. Whether you're a seasoned developer or just starting out:

  • Experiment with the language
  • Suggest new "dog-themed" features
  • Help improve documentation
  • Add new functionality
  • Fix bugs

The goal is to create something enjoyable while learning about language design and interpretation. Pull requests and issues are very welcome on GitHub!

Overview

DogLang is a programming language with the following components:

  • Lexical analyzer (Tokenizer)
  • Syntax analyzer (Parser)
  • Semantic analyzer
  • Symbol table for variable management
  • Interpreter for code execution

Language Features

  • Variable assignments
  • Arithmetic operations
  • Conditional statements (sniff)
  • Loop constructs (wagtail)
  • Print statements (bark)
  • Input (fetch)
  • Comparison operators

Syntax Guide

Variables and Assignment

a = 10;

Print Statement

bark(variable_name);

Loop Statement

wagtail(condition) {
  // loop body
}

Conditional Statement

sniff(condition) {
  // if true
} else {
  // if false
}

Input Statement

a = fetch("Enter a value:");

Examples

Basic Loop Example

a = 0;
wagtail(a<100) { 
  bark(a);
  a = a+10;
}

This program initializes a variable a to 0, then loops while a is less than 100, printing the value of a and incrementing it by 10 each iteration.

Conditional Example

a = 10;
sniff(a%2==0) {
  bark("Even");
} else {
  bark("Odd");
}

This program checks if variable a is even or odd and prints the result.

Input Example

a = fetch("Enter the number");
wagtail(a<10) {
  bark(a);
  a = a+1;
}

This program asks the user for a number and then counts from that number up to 10.

How to Use DogLang

Installation

From GitHub

Clone this repository to your local machine:

git clone https://github.com/pallavrai/doglang.git
cd doglang

From PyPI

Install DogLang directly using pip:

pip install doglang

Running a DogLang Program

If installed from GitHub:

  1. From a file:

    python doglang.py -f your_program.doggy
    
  2. Directly from the command line:

    python doglang.py -e "a=10; bark(a);"
    

If installed from pip:

  1. From a file:

    doglang -f your_program.doggy
    
  2. Directly from the command line:

    doglang -e "a=10; bark(a);"
    

Additional Options

  • To view the tokens generated from your code:
    doglang -f your_program.doggy --tokens
    

File Extensions

DogLang programs use the .doggy file extension.

Language Reference

Keywords

  • bark: Print a value
  • wagtail: Loop construct
  • sniff: Conditional statement
  • fetch: Input from user
  • else: Alternative branch for conditionals

Operators

  • Arithmetic: +, -, *, /, %
  • Comparison: ==, !=, >, <, >=, <=
  • Assignment: =

Tips for Writing DogLang Programs

  1. Each statement should end with a semicolon (optional in some contexts)
  2. Blocks of code are enclosed in curly braces {}
  3. Variables don't need type declarations - they're inferred automatically

Limitations

  • Currently only supports integer and string data types
  • No function definitions
  • Limited error reporting

Project Structure

  • Tokenizer.py: Lexical analyzer
  • SyntaxAnalyser.py: Parser
  • SemanticAnalyser.py: Semantic analyzer
  • main.py: Interpreter implementation
  • SymbolTable.py: Symbol table for variable management

Metadata

Release files for doglang 1.0.0a0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for doglang 1.0.0a0
File Size Uploaded
doglang-1.0.0a0.tar.gz 10.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for doglang 1.0.0a0
File Interpreter ABI Platform
doglang-1.0.0a0-py3-none-any.whl Python 3 none any Details

Total release size: 20.3 kB

Release files / doglang-1.0.0a0.tar.gz

Download URL doglang-1.0.0a0.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
51d1446ba5ee48126c63b8dc5be3aee8add75b3561d9c838c8ff48f9d152aa07
BLAKE2b-256 checksum
How to use checksums
3be8ef365b4114501c70d93a5b554395f89df5518212baa74c3275e52f7bd71b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.6

Release files / doglang-1.0.0a0-py3-none-any.whl

Download URL doglang-1.0.0a0-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01a8676d37693f871509817d39486f4efb5ac5198ebb077d5767e948516f5eeb
BLAKE2b-256 checksum
How to use checksums
7789fdfd84090a121ccaba94c211ac255d73fbcc1abd2ff696d9ca3014685e92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.6

Release history Release notifications | RSS feed

This release

1.0.0a0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page