/pld

Primary LanguageC#

CodeWave Programming Language

CodeWave is a programming language designed by Me. It is a simple language that supports basic programming constructs like variable assignment, arithmetic operations, loops, conditionals, and switch statements.

Grammar

The CodeWave grammar consists of the following terminals and non-terminals:

Terminals

  • identifier: A string that starts with a letter and may contain letters, digits, and underscores.
  • int: An integer.
  • float: A floating-point number.

Non-terminals

  • <program>: The starting symbol that represents a CodeWave program.
  • <constant>: A non-terminal that represents a constant declaration or assignment statement.
  • <assignment>: A non-terminal that represents an assignment statement.
  • <assignment_op>: A non-terminal that represents an assignment operator.
  • <declaration>: A non-terminal that represents a variable declaration.
  • <for_assignment>: A non-terminal that represents a for loop assignment.
  • <for_inc_dec>: A non-terminal that represents a for loop increment or decrement.
  • <expression>: A non-terminal that represents a boolean expression.
  • <statement_list>: A non-terminal that represents a list of statements.
  • <add>: A non-terminal that represents an addition operation.
  • <sub>: A non-terminal that represents a subtraction operation.
  • <div>: A non-terminal that represents a division operation.
  • <mul>: A non-terminal that represents a multiplication operation.

Usage

To use CodeWave, write a program in the CodeWave language using the grammar rules above, and then compile or interpret it using a CodeWave compiler or interpreter.

Example

Here is an example CodeWave program that calculates the factorial of the number 5 and outputs the result:

image

And here's an example CodeWave program with an error:

image