/PeriodiCode

Primary LanguagePythonCreative Commons Zero v1.0 UniversalCC0-1.0

PeriodiCode

PeriodiCode - Toy Language Description:

PeriodiCode is a toy programming language that combines elements from the periodic table with coding concepts, providing an interactive and playful coding experience.

The language operates within a data dictionary called "data," where variables and their corresponding values are stored. Users can declare variables and define functions using the names of chemical elements, adding a whimsical touch to their code. Here are some key features and functions of PeriodiCode:

Code Snippets:

  1. Hydrogen(x): Allows users to declare variables and store their values in the data dictionary.

    Hydrogen x 10;
  2. Iron(variable): Retrieves and prints the value of a given variable from the data dictionary.

    Iron x;
  3. Carbon(numbers): Calculates the sum of a list of numbers or variables, replacing variables with their corresponding values from the data dictionary.

    Carbon x 5 3;
  4. Oxygen_for(start, end): Prints a range of numbers specified by the "start" and "end" arguments, considering variables and converting values as needed.

    Oxygen_for 1 5;
  5. Oxygen_iter(sequence): Iterates over a sequence of elements, either a list or a variable, and prints each element.

    Oxygen_iter sequence;

In addition to these functions, here's an example of how you can use PeriodiCode to add two numbers:

Hydrogen num1 5;
Hydrogen num2 10;
Carbon "num1" "num2"

The above code declares two variables, num1 and num2, assigns them values, and then uses the Carbon function to calculate their sum. The result will be printed as 15.

PeriodiCode offers a playful and engaging environment for beginners or anyone seeking a creative and whimsical programming experience.