A dog-themed programming language interpreter
Project description
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:
-
From a file:
python doglang.py -f your_program.doggy -
Directly from the command line:
python doglang.py -e "a=10; bark(a);"
If installed from pip:
-
From a file:
doglang -f your_program.doggy -
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 valuewagtail: Loop constructsniff: Conditional statementfetch: Input from userelse: Alternative branch for conditionals
Operators
- Arithmetic:
+,-,*,/,% - Comparison:
==,!=,>,<,>=,<= - Assignment:
=
Tips for Writing DogLang Programs
- Each statement should end with a semicolon (optional in some contexts)
- Blocks of code are enclosed in curly braces
{} - 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 analyzerSyntaxAnalyser.py: ParserSemanticAnalyser.py: Semantic analyzermain.py: Interpreter implementationSymbolTable.py: Symbol table for variable management
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file doglang-1.0.0a0.tar.gz.
File metadata
- Download URL: doglang-1.0.0a0.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51d1446ba5ee48126c63b8dc5be3aee8add75b3561d9c838c8ff48f9d152aa07
|
|
| MD5 |
58a6d24ea6084265748193d1ebb77de7
|
|
| BLAKE2b-256 |
3be8ef365b4114501c70d93a5b554395f89df5518212baa74c3275e52f7bd71b
|
File details
Details for the file doglang-1.0.0a0-py3-none-any.whl.
File metadata
- Download URL: doglang-1.0.0a0-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01a8676d37693f871509817d39486f4efb5ac5198ebb077d5767e948516f5eeb
|
|
| MD5 |
3ad5aac8dc7b176ca618d77aff5049d2
|
|
| BLAKE2b-256 |
7789fdfd84090a121ccaba94c211ac255d73fbcc1abd2ff696d9ca3014685e92
|