Skip to content

Latest commit

 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

PNA

pna is a custom scripting language with a simple, readable syntax designed to define variables, objects, conditionals, loops, and logging output. It supports built-in functions, input/output, and flow control structures like if, loop, break, and continue.

Variable Definition

object style devlaration

enemy: {
    name: "Slime",
    hp: 100,
}
  • Defines a dictionary-style variable enemy with properties name and hp.

Assignment

Assign to a field:

enemy.hp: 75
  • Sets the hp field of enemy to 75.

Arithmetic and expressions are supported:

enemy.hp: enemy.hp - 10

Looping

Log to console :

log "Hello"
log "HP: " + str(enemy.hp)
  • Strings can be concatenated with +.
  • str() converts other types to string for logging.

Built-in Functions

Pna supports various built-in functions:

randint 1 10       // Random int from 1 to 10
str(123)           // Convert to string
int("123")         // Convert to integer
len("abc")         // Length of string
not true           // Boolean not
inlist "a" "a,b,c" // True

Input

Get user input :

input "What is your name?" -> player.name
  • Asks the question and stores input into player.name.

If no prompt:

input "NO" -> player.age
  • Equivalent to input() in python.

Conditionals

If-style block:

cond (enemy.hp <= 0) -> {
    log "Enemy defeated!"
} end
  • If condition is true, the block runs.

Loops

loop block with condition:

loop (anycondition) -> {
    log "Repeating"
    break
} end
  • Runs while the condition is true.

Supports break and continue:

break       // exits the loop
continue    // skips to next iteration

About

pna language.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages