Calc

From Esolang
Jump to navigation Jump to search
Not to be confused with CALC.

About

calc is a minimalistic esoteric programming language designed around the concept of calculations. The language consists of mathematical operations and three basic keywords. It is designed to be as simple as possible, with the primary goal of evaluating calculations. it is also made by ChatGPT (4o-mini. and so is this page with some changes.).

Overview

Calc is a language where the entire syntax is based on performing mathematical calculations. It features three keywords:

  • start - marks the beginning of the program.
  • end - marks the end of the program.
  • print - prints the result of a calculation.

Any other line is considered a mathematical expression and is executed as a calculation. The language is interpreted using JavaScript (Not normal JavaScript, Node.JS), and files are given a `.cal` extension.

Syntax

The syntax of Calc consists of the following components:

1. start

The program begins with the keyword start.

2. end

The program ends with the keyword end.

3. print

The keyword print outputs the result of a calculation.

4. Calculations

Any mathematical expression is valid. You can use basic arithmetic operators like `+`, `-`, `*`, and `/`. Expressions are evaluated sequentially.

Example Program

start
    5 + 5
    print 10 * 2
    # comment
    7 / 3
end

the start in the first line is to start the program. the end in the bottom line is to end the program.