Welcome to the Kannada Python Compiler project! This unique compiler allows you to write Python-like code using Kannada keywords and identifiers, bringing programming closer to Kannada speakers.
The primary goal of this project is to make programming more accessible to Kannada speakers, especially beginners and students. By allowing the use of Kannada keywords and identifiers, we aim to reduce the language barrier in learning programming concepts. This project serves as:
- An educational tool for teaching programming concepts in Kannada.
- A bridge for Kannada speakers to transition into mainstream programming languages.
- A demonstration of language localization in programming environments.
- Lexical analysis and parsing of Kannada-based Python-like syntax
- Support for basic control structures (if-else, while loops)
- Variable assignments and arithmetic operations
- Print statements for output
- Abstract Syntax Tree (AST) generation for parsed code
To build and run this compiler, you need:
- GCC (GNU Compiler Collection)
- Make
These tools are usually pre-installed on most Unix-based systems (Linux, macOS). For Windows users, consider using WSL (Windows Subsystem for Linux) or MinGW.
-
Clone this repository:
git clone https://github.com/yourusername/kannada-python-compiler.git cd kannada-python-compiler
-
Build the compiler:
make
This will create the kannada_compiler
executable in the bin
directory.
To compile a Kannada Python file:
make run ARGS="path/to/your/kannada_python_file.kpy"
Replace path/to/your/kannada_python_file.kpy
with the actual path to your Kannada Python source file.
Here's a brief overview of the Kannada Python syntax:
- Use
ಯದಿ
forif
- Use
ಅನ್ಯಥಾ
forelse
- Use
ಆಗಿರುವ
forwhile
- Use
ಮುದ್ರಿಸು
forprint
- Use
ನಿಜ
forTrue
- Use
ಸುಳ್ಳು
forFalse
- Use
ಶೂನ್ಯ
forNone
Example:
ಸಂಖ್ಯೆ = ೧೦
ಯದಿ ಸಂಖ್ಯೆ > ೫:
ಮುದ್ರಿಸು("ಸಂಖ್ಯೆ ೫ಕ್ಕಿಂತ ದೊಡ್ಡದು")
ಅನ್ಯಥಾ:
ಮುದ್ರಿಸು("ಸಂಖ್ಯೆ ೫ಕ್ಕಿಂತ ಚಿಕ್ಕದು ಅಥವಾ ಸಮ")
The following components have been implemented and are working:
- Lexer (Tokenizer)
- Recognizes Kannada keywords, identifiers, and literals
- Handles basic operators and punctuation
- Parser
- Constructs Abstract Syntax Tree (AST) from tokens
- Supports basic language constructs (if-else, while loops, assignments)
- Abstract Syntax Tree (AST)
- Defines node structures for various language constructs
- Includes utilities for creating and manipulating AST nodes
- Symbol Table
- Management of identifiers and their attributes
- Main Compiler Driver
- Coordinates lexing and parsing phases
- Provides basic error reporting
- Semantic Analyzer
- Type checking
- Scope analysis
- Error detection for semantic issues
- Intermediate Code Generator
- Translation of AST to an intermediate representation
- Code Optimizer
- Optimization passes on the intermediate representation
- Code Generator
- Generation of target machine code or bytecode
- Error Handler
- Comprehensive error reporting and recovery mechanisms
- Standard Library
- Implementation of basic I/O, math, and other standard functions in Kannada
Our next steps in the development of the Kannada Python Compiler include:
- Implementing the Semantic Analyzer to catch semantic errors and perform type checking.
- Developing an Intermediate Code Generator to translate the AST into a lower-level representation.
- Creating a basic Code Generator to produce executable output.
- Expanding the language features to include functions, modules, and more complex data structures.
- Developing a standard library with common functions and utilities accessible in Kannada.
We welcome contributions in any of these areas! Check our issues page for specific tasks or propose new features.
We welcome contributions to the Kannada Python Compiler project! Whether it's adding new features, improving documentation, or reporting bugs, your help is appreciated. Please feel free to submit pull requests or open issues on our GitHub repository.
This project is licensed under the MIT License - see the LICENSE file for details.
- Thanks to all contributors who have helped shape this project. Especially, ME... Kaushik Dey!
- Special thanks to the Kannada-speaking community for their support and feedback.
Happy coding in Kannada! ಸಂತೋಷದ ಕೋಡಿಂಗ್!