PriyoScriptPriyoScript
Basics

Syntax Basics

Core PriyoScript syntax in a structured, beginner-friendly reference format.

Theory

Syntax is the formal grammar that tells PriyoScript how to read and execute your program. If syntax is valid, the interpreter can understand your intent and run statements in deterministic order. PriyoScript is designed to keep this grammar explicit and readable, so beginners can identify program structure quickly while still writing production-quality logic. In practical terms, syntax defines how you enter a program (monalisa { ... }), how you store data, how you branch and loop, how you define reusable functions, and how you organize code through modules and classes.

Why this matters

Good syntax habits reduce debugging time and make every advanced concept easier to learn.

Syntax Catalog

Basic Structure

SyntaxDescription
monalisa { ... }Program entry block. All executable statements start here.
// commentSingle-line comment.
/* comment */Multi-line comment block.

Literals and Values

SyntaxDescription
123, 3.14Number literals.
"mona"String literal.
priyoTrue, priyoFalseBoolean literals.
priyoEmptyNull-like empty value.

Variables and Assignment

SyntaxDescription
priyoKeep x = 1Function-scoped mutable declaration.
priyoChange x = 1Block-scoped mutable declaration.
priyoPromise x = 1Block-scoped immutable binding.
x = x + 1Reassignment (not valid for priyoPromise).

Expressions and Operators

SyntaxDescription
a + b, a - b, a * b, a / bArithmetic expressions.
a == b, a >= b, a != bComparison expressions.
a && b, a || b, !aLogical expressions.
(a + b) * cGrouping with precedence control.

Control Flow

SyntaxDescription
prakritiIf (...) { ... }Conditional branch.
prakritiElseIf (...) { ... }Additional condition branch.
prakritiElse { ... }Fallback branch.
prakritiCount (...) { ... }Counted loop.
prakritiAsLongAs (...) { ... }While loop.
prakritiStop, prakritiGoOnBreak/continue style flow control.
prakritiThink("label")Debug checkpoint marker for trace.

Functions

SyntaxDescription
lisaaTask name(...) { ... }Function declaration.
prakritiWait lisaaTask ...Async function declaration (stage-1).
priyoGiveBack valueReturn from function.
name(arg)Function call.
prakritiPause exprAwait value inside async functions (top-level await supported).

Concurrency Runtime

SyntaxDescription
priyoConcurrency.group("label")Create a structured task group.
group.run(task, arg1, arg2)Start a task immediately inside the group.
group.schedule(25, task, arg1)Start a task after a delay in milliseconds.
prakritiPause group.all()Wait for all tasks in the group.
group.token()Get the shared cancellation token.
token.throwIfCancelled()Stop cooperatively if the token was cancelled.
prakritiPause priyoConcurrency.afterDelay and resume later with a value or null.

Arrays

SyntaxDescription
[1, 2, 3]Array literal.
arr[0]Index read.
arr[1] = 9Index write.
arr[1:3]Slice (range extraction).

OOP

SyntaxDescription
lisaaFamily ClassName { ... }Class declaration.
priyoCreate ClassName(...)Instance creation.
priyoSelfCurrent instance reference.
lisaaInherit ParentInheritance from parent class.
priyoParent(...)Parent constructor call.

Modules and Packages

SyntaxDescription
lisaaBox { ... }Module declaration boundary.
lisaaShare symbolModule export.
lisaaBring "path": aliasModule import with alias.
lisaaBring mathBuilt-in package import.

Example Programs

Example 1: Basic Output + Variables

monalisa {
  priyoKeep name = "mona"
  priyoPromise version = "stable"
  priyoTell("Hello " + name + " (" + version + ")")
}

Expected output:

Hello mona (stable)

Example 2: Condition + Loop

monalisa {
  prakritiCount (priyoChange i = 1; i <= 3; i = i + 1) {
    prakritiIf (i == 2) {
      priyoTell("middle")
    } prakritiElse {
      priyoTell(i)
    }
  }
}

Expected output:

1
middle
3

Example 3: Function + Array

monalisa {
  lisaaTask sum2(a, b) {
    priyoGiveBack a + b
  }

  priyoKeep nums = [5, 7]
  priyoTell(sum2(nums[0], nums[1]))
}

Expected output:

12

Common mistake

Do not use priyoGiveBack outside a function body.

Practice Check

Concept Check

  1. Which declaration should you choose for a value that must not be reassigned?
  2. What is the difference between arr[1] and arr[1:3]?
  3. Why must executable code be inside monalisa { ... }?

Last updated on

On this page