EcoScript Programming Language

EcoScript (.ecs) is a programming language built upon python designed with sustainability in mind. With the constant growth in computational technologies, energy consumption is escalating at an alarming rate. EcoScript takes a step towards understanding and optimizing the energy efficiency of code, aiming to contribute to global sustainable development.

Why EcoScript?

Computers use energy. With more and more processes being automated, energy consumption from computational activities is on the rise. EcoScript is designed to make developers conscious of the energy their code consumes, fostering a mindset of sustainability.

How EcoScript Measures Energy

Energy Tracking: The energy consumption values in EcoScript are assigned for illustration purposes. Basic operations, like addition or multiplication, are given arbitrary energy costs, which are then accumulated as the code executes.

Carbon Footprint Estimation: Similarly, the carbon footprint values are illustrative and assigned based on the tracked energy consumption. These values are not meant to reflect real-world carbon emissions but serve to visualize the connection between code execution and potential environmental impact.

Under the Hood

1. Lexer: It reads the code and identifies variables, operators, and other components.

2. Parser: This processes the identified components, executing operations like calculations.

3. Energy Tracking: Integrated within the parser, this feature tracks energy consumption as the code executes.

4. Interpreter: EcoScript can be run interactively or from files, similar to many established programming languages.

Why Python?

EcoScript's foundation lies in Python, a widely-used programming language known for its readability and versatility. This makes the interpreter more accessible to developers and allows for seamless integration with existing Python libraries.

1. Lexer: Built with the Sly library, the lexer identifies the various components in EcoScript, such as variables, operators, and control flow statements.

2. Parser: Also utilizing Sly, the parser translates the components identified by the lexer into executable code. It's here that the energy tracking and carbon footprint calculations occur.

Features

Syntax


Variables

Loading code...

Arithmetic

Loading code...

Print Function

Loading code...

Control Flow (work in progress)

Loading code...

Sample

Loading code...

Output: 30 Energy Consumed: 4 Carbon Footprint: 0.3950000000000001

Local Installation

Loading code...
Loading code...
Loading code...

Made by Kaushal Barhate