Get started with PCL (Persona Control Language) in 5 minutes!
This guide will walk you through installing PCL, writing your first persona, and running it through the compiler.
Make sure you have:
- Node.js 20.0.0 or higher (download here)
- npm (comes with Node.js)
- A code editor (VS Code recommended)
Check your versions:
node --version # Should be v20.0.0 or higher
npm --version # Should be 10.0.0 or highergit clone https://github.com/personamanagmentlayer/pcl.git
cd pclnpm installThis installs:
- TypeScript compiler
- Vitest test runner
- ESLint and Prettier for code quality
- Build tools (tsup, tsx)
npm run buildThis compiles the TypeScript source code to JavaScript in the dist/ folder.
Verify the build:
node dist/cli/index.js --versionYou should see version information (or a successful execution).
Create a new file called hello-persona.pcl:
// Define a helpful assistant persona
persona HELPER {
intent: "Provide helpful and friendly assistance"
tone: friendly
skills {
"Active listening"
"Clear communication"
"Problem solving"
}
constraints {
"Be concise and respectful"
"Ask clarifying questions"
}
}
// Export for use in other files
export HELPER
Run the parser to see the Abstract Syntax Tree (AST):
npm run parse hello-persona.pclor using the CLI directly:
node dist/cli/index.js parse hello-persona.pclExpected output:
- Pretty-printed AST showing PersonaDeclaration, skills, constraints, etc.
- No parse errors β
Run the semantic analyzer to validate types and catch errors:
npm run check hello-persona.pclor:
node dist/cli/index.js check hello-persona.pclExpected output:
- "β No semantic errors" (if everything is correct)
- Error messages with line/column numbers (if there are issues)
Launch the interactive REPL to experiment with PCL expressions:
npm run replor:
node dist/cli/index.js replTry these commands:
pcl> let name = "Alice"
pcl> let age = 30
pcl> name
"Alice"
pcl> age + 10
40
Type .exit or press Ctrl+C twice to quit.
Run all tests to verify your installation:
npm testYou should see:
- β SymbolTable tests (8 passing)
- β TypeChecker tests (13 passing)
- β SemanticAnalyzer tests (33/35 passing - expected)
- β Runtime tests (30/33 passing - expected)
Run tests in watch mode (auto-rerun on file changes):
npm run test:watchGenerate coverage report:
npm run test:coverageCoverage report will be in coverage/index.html.
Check out examples/showcase.pcl for more complex examples:
cat examples/showcase.pclor
Get-Content examples/showcase.pclParse the showcase:
npm run parse examples/showcase.pclInstall recommended extensions:
- Open VS Code in the
pclfolder - Look for the "Install Workspace Recommended Extensions" notification
- Click "Install All" (30+ extensions including Copilot, ESLint, Prettier)
Configure GitHub Copilot:
- Copilot will automatically read .github/copilot-instructions.md
- This provides 500+ lines of PCL-specific guidance for AI pair programming
Debugging:
- Press
F5to launch the debugger - Choose from 6 preconfigured debug profiles:
- Debug PCL CLI
- Debug Current TypeScript File
- Debug Vitest Tests
- Debug Parser
- Attach to Node Process
| Command | Description |
|---|---|
npm run build |
Compile TypeScript to JavaScript |
npm run build:watch |
Compile in watch mode (auto-rebuild) |
npm test |
Run all tests |
npm run test:watch |
Run tests in watch mode |
npm run test:coverage |
Generate coverage report |
npm run typecheck |
Check types without emitting files |
npm run lint |
Lint source code with ESLint |
npm run lint:fix |
Auto-fix linting issues |
npm run format |
Format code with Prettier |
npm run format:check |
Check if code is formatted |
npm run clean |
Remove build artifacts |
npm run parse <file> |
Parse a PCL file |
npm run check <file> |
Type-check a PCL file |
npm run repl |
Launch interactive REPL |
pcl-lite/
βββ src/ # TypeScript source code
β βββ lexer/ # Tokenizer
β βββ parser/ # Syntax parser
β βββ semantic/ # Type checker and semantic analyzer
β βββ ast/ # AST node definitions
β βββ types/ # Type system
β βββ runtime/ # Execution engine
β βββ codegen/ # Code generator (planned)
β βββ stdlib/ # Built-in personas and utilities
β βββ cli/ # Command-line interface
βββ tests/ # Test suite
β βββ semantic.test.ts # Semantic analyzer tests
β βββ runtime.test.ts # Runtime tests
β βββ integration.test.ts # Integration tests
βββ examples/ # Example PCL programs
βββ .github/ # GitHub Actions workflows
β βββ copilot-instructions.md # Copilot guidance
βββ .vscode/ # VS Code configuration
βββ dist/ # Compiled JavaScript (after build)
βββ package.json # npm package configuration
βββ tsconfig.json # TypeScript configuration
βββ vitest.config.ts # Test configuration
βββ QUICKSTART.md # This file!
- README.md - Project overview and features
- CHANGELOG.md - Version history and release notes
- GitHub Copilot Instructions - Coding standards and patterns
- PCL Bootstrap Specification - Persona system deep dive
- Grammar:
src/grammar/pcl.ebnf- EBNF grammar specification - AST:
src/ast/index.ts- AST node definitions - Type System:
src/types/index.ts- Type definitions - Semantic Rules:
src/semantic/index.ts- Type checking logic
- Test Examples: Browse
tests/*.test.tsfor usage examples - Coverage: Run
npm run test:coverageand opencoverage/index.html
npm run typecheckCheck the error messages for type issues.
Known issues (expected failures):
- 2/35 semantic tests: Duplicate declaration detection
- 3/33 runtime tests: Team messaging edge cases
- 12/17 integration tests: Under development
If you see additional failures, try:
npm run clean
npm install
npm run build
npm testMake sure you've built the project:
npm run build
node dist/cli/index.js --versionReload the TypeScript server:
- Press
Ctrl+Shift+P(Windows/Linux) orCmd+Shift+P(Mac) - Type "TypeScript: Restart TS Server"
- Press Enter
- Syntax Reference - Complete syntax guide with examples
- Getting Started Guide - Detailed tutorials
- Examples - Real-world PCL examples
- Formal Grammar - EBNF specification
// Team composition
team SECURITY_REVIEW {
members: [SEC, AUDIT, ARCHI]
primary: SEC
merge: consensus
}
// Workflow orchestration
workflow SECURE_CODE_REVIEW {
input: code: String
output: report: String
steps {
step analyze {
persona: SEC
action: "Analyze code for vulnerabilities"
}
step audit {
persona: AUDIT
action: "Check compliance"
}
step recommend {
persona: ARCHI
action: "Suggest improvements"
}
}
}
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Make your changes and add tests
- Run tests:
npm test - Lint and format:
npm run lint:fix && npm run format - Commit with conventional commits:
git commit -m "feat: add new feature" - Push and create a Pull Request
Read GitHub Copilot Instructions for coding standards.
Found a bug? Have a feature request?
Open an issue: https://github.com/personamanagmentlayer/pcl/issues
Please include:
- PCL version (
npm list @pcl/sdk) - Node.js version (
node --version) - Operating system
- Steps to reproduce
- Expected vs actual behavior
- GitHub: https://github.com/personamanagmentlayer/pcl
- Issues: https://github.com/personamanagmentlayer/pcl/issues
- Discussions: https://github.com/personamanagmentlayer/pcl/discussions
PCL is licensed under Apache-2.0. See LICENSE for details.
π Congratulations! You're now ready to start building with PCL!
Happy coding! π