Skip to content

chauhansumitdev/riser-lang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

status: 200 status: 200

2

🟠 Language Overview

riser_ is a dynamically-typed programming language that supports basic programming constructs like variables, control structures, functions, and operators.

🟡 Language Features

  • Dynamically Typed: Types are determined at runtime, no need for type declarations.

  • Primitive Data Types:

    • int - Integer values (e.g., 1, -42)
    • float - Floating-point numbers (e.g., 3.14, -0.5)
    • string - Sequence of characters (e.g., "Hello, World")
    • bool - Boolean values (true, false)
  • Variables:

    • Variables are declared using the let keyword. Example:
      let x = 10;
      let name = "India";
      
  • Operators:

    • Arithmetic: +, -, *, /, %
    • Comparison: ==, !=, <, >, <=, >=
    • Logical: && (and), || (or), ! (not)
  • Control Structures:

    • Conditional statements:
      if (x > 10) {
          print("Greater than 10");
      } else {
          print("Less than or equal to 10");
      }
      
    • Loops (while, for):
      let i = 0;
      while (i < 5) {
          print(i);
          i = i + 1;
      }
      
      for (let i = 0; i < 5; i = i + 1) {
          print(i);
      }
      
  • Functions:

    • Define and call functions:
      func greet(name) {
          print("Hello, " + name);
      }
      
      greet("World");
      
    • Return values from functions:
      func add(a, b) {
          return a + b;
      }
      
      let result = add(5, 10);
      
  • Built-in Functions:

    • print() - Outputs text to the console.
    • input() - Reads user input (optional for your implementation).
  • Comments:

    • Single-line comments using //:
      // This is a comment
      
  • Error Handling:

    • Basic error detection for common issues like division by zero.

🟠 Example Program in riser_

// comment

func add(a, b) {
    return a + b;
}

let x = 5;
let y = 10;
let result = add(x, y);

if (result > 10) {
    print("Result is greater than 10");
} else {
    print("Result is 10 or less");
}
  • Save the file name.rr
  • Run make if the .class files are not present (one time).
  • Run java Riser name.rr

Note: This implementation does not purely follow standard compiler/interpreter design principles and the theoretical aspects of formal languages and automata.

About

riser programming language.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published