ANIL is a statically typed programming language, seamlessly blending the best of Python and C++. Designed for embedding within C source files, ANIL transpiles your code into efficient C, enabling developers to write high-level logic with low-level performance. Experience enhanced features like templates, classes, and reflection—all while achieving the speed your applications demand.
Welcome to ANIL (A Nice Intermediate Language)
ANIL is a statically typed programming language inspired by Python and C++, designed for easy embedding within C source files. Its unique ability to transpile code into C allows developers to leverage C's performance while utilizing modern programming features.
This illustration shows a comparison between functions implemented in C and ANIL. The C implementation handles the general logic for the __contains__
method, while ANIL provides a specialized template for the String
class.
Key Features of ANIL
-
C Code Generation: ANIL compiles to C code, which can then be processed using any standard C compiler, ensuring compatibility and efficiency.
This image demonstrates the generated C code from the
__contains__
method in the previous visual. -
Rich Language Features:
- Classes with intuitive syntax (Example 1, Example 2)
- Templates & Function Overloading with practical examples (View Example)
- Macros for flexible code structures (View Example)
- Compile-Time Reflection capabilities (Example 1)
- Annotations allowing custom behavior (Example 1, WebServer Example)
- Dunder Methods: Powerful built-in features for object-oriented programming like
__init__
,__del__
,__getitem__
, and more.
Project Structure
- Bootstrap Directory: Contains the compiler's implementation, showcasing advanced features of ANIL itself.
- Examples Directory: A collection of demonstrations illustrating various features of the language and its standard library.
- Lib Directory: Home to the ANIL standard library containing reusable code.
Usage
To start using ANIL, run the provided preprocess_2.py
script to generate C code from your ANIL files. This simple process allows you to compile and execute your ANIL projects efficiently. Here's how:
python preprocess_2.py
You can also directly specify a filename:
python preprocess_2.py --filename examples\FILE_NAME*.c
After generating the FILE_NAME*_generated.c
file, use a C compiler to create the executable.
Learn By Example
Explore the examples/
and Lib/
folders to view practical examples that demonstrate the unique capabilities of ANIL. These serve as both documentation and inspiration for your own projects.
Whether you're interested in compiler development, looking to embed a programming language within C or simply excited about experimenting with new languages, ANIL provides a robust and enriching environment.