Getting Started
V0.1Welcome to ps-lang! This guide will help you understand the fundamentals of writing pseudocode that both humans and AI can understand and execute.
What is ps-lang?
ps-lang is a pseudocode-style programming language designed specifically for human-AI collaboration. It bridges the gap between natural language descriptions and executable code, making it easier for both humans and AI systems to understand, modify, and execute algorithms.
Core Principles
Readability First
Every ps-lang program should read like a clear, step-by-step explanation of what the code does.
AI-Friendly
Structured syntax that AI models can easily parse, understand, and generate.
Executable
Not just documentation—ps-lang programs can be compiled and run directly.
Collaborative
Designed for seamless handoffs between human developers and AI assistants.
Your First Program
Let's start with a simple example that demonstrates the basic structure of a ps-lang program:
DEFINE simple_calculator: INPUT: first_number as number operation as string second_number as number PROCESS: IF operation equals "add": SET result = first_number + second_number ELSE IF operation equals "subtract": SET result = first_number - second_number ELSE IF operation equals "multiply": SET result = first_number * second_number ELSE IF operation equals "divide": IF second_number equals 0: OUTPUT: "Error: Division by zero" RETURN ELSE: SET result = first_number / second_number ELSE: OUTPUT: "Error: Unknown operation" RETURN OUTPUT: result EXECUTE simple_calculator WITH 10, "add", 5
Breaking it Down
Declares a new function or procedure. Every ps-lang program starts with defining what it does.
Specifies what data the function needs to work with, including parameter names and types.
Contains the main logic of your program. This is where the actual work happens.
Defines what the function returns or displays as its result.
Runs the function with specific values. This is how you actually use your defined functions.