Practical runtime studies

Learn by reading, running, and changing examples.

Explore compact PIR and PASM programs, follow their bytecode path, and use each example as a starting point for understanding virtual-machine behavior.

Source code displayed on a developer workstation
Examples are executable explanations.Start with a small instruction sequence, then compare source code with the resulting runtime behavior.

Example library

Choose a small program and trace the model.

These categories preserve the original learning path while presenting it as a practical reference for virtual-machine development.

PIR / HIGHER LEVEL

Portable Intermediate Representation

Read structured examples that show values, operations, subroutines, and the relationship between source instructions and runtime execution.

Explore PIR examples
PASM / LOWER LEVEL

Parrot Assembly

Inspect compact assembly-oriented programs to see registers, operations, control flow, and explicit bytecode-oriented thinking.

Explore PASM examples

Example conventions

Separate source, output, and guidance at a glance.

A consistent visual language makes it easier to distinguish what you write, what the runtime prints, and what deserves extra attention.

hello.pirsource
.sub 'main'
    say "HELLO"
    .return
.end

How to read the examples

  • Blue marks source instructions and runtime commands.
  • Green marks expected output or literal values.
  • Red highlights warnings and troubleshooting notes.
  • Save PIR files with .pir and PASM files with .pasm.

Running a sample

From file to bytecode in three steps.

Use a local runtime executable, then compare direct execution with an explicitly compiled bytecode file.

Save the source

Place the example in a file using the suffix expected by its language or assembly format.

Run it directly

Invoke the runtime with the source file and inspect the output or diagnostic information.

Compile and repeat

Write a bytecode file, execute it again, and compare the two paths.

Command reference

Keep the execution loop visible.

The commands below are intentionally small: they make the distinction between source input, compiled bytecode, and runtime output easy to inspect.

terminalworkflow
# Run the source example
parrot foo.pir

# Compile, then run bytecode
parrot -o foo.pbc foo.pir
parrot foo.pbc

About this page

PCode Vault examples

This page collects compact runtime exercises for readers who want to move from documentation into execution. For questions or corrections about the resource, write to info@pcodevault.en-html.com.