Pseudocode (Sobol Notation)
VS Code extension providing syntax highlighting, snippets, and validation for pseudocode based on Mariusz Sobol's notation used at Pedagogical University of Krakow.
Features
Syntax Highlighting
Rich syntax highlighting for .alg files and pseudocode code blocks in Markdown:
- Keywords:
algorithm, if, then, else, for, to, do, while, return
- Operators:
←, +, -, *, /, mod, div, <, >, ≤, ≥, =, ≠
- Data types:
int, float, string, bool, array, list
- Built-in functions:
length(), print(), read(), push(), pop()
- Comments:
// single-line
- Braces:
{ } for code blocks (not "end" keywords)
Code Snippets
27+ intelligent code snippets for common patterns:
| Prefix |
Description |
alg |
Algorithm template |
if, ife |
If/if-else statements |
for, fore |
For loops (to/downto) |
while |
While loop |
arr, mat |
Array/matrix declarations |
func |
Function definition |
swap |
Swap two variables |
max, min |
Find maximum/minimum |
Type prefix + Tab to expand snippet.
Commands
- Validate Syntax (
Ctrl+Shift+V): Check pseudocode for syntax errors
- Insert Arrow (
Ctrl+Shift+A): Insert assignment arrow ←
- New Algorithm File (
Ctrl+Shift+N): Create new .alg file with template
Markdown Integration
Write pseudocode in Markdown code blocks with syntax highlighting:
```pseudocode
algorithm BubbleSort(A[0..n-1]) {
for i ← 0 to n-2 do {
for j ← 0 to n-2-i do {
if A[j] > A[j+1] then {
temp ← A[j]
A[j] ← A[j+1]
A[j+1] ← temp
}
}
}
}
```
Syntax Rules
Based on Mariusz Sobol's notation:
Assignment: Use arrow ← (not =)
x ← 5
Braces: Use { } (not "begin/end")
if x > 0 then {
print(x)
}
Algorithm structure:
algorithm Name(parameters) {
// declarations
// body
return result
}
Arrays: 0-indexed with range notation
A[0..n-1]
Installation
From VSIX (Recommended)
- Download
pseudocode-sobol-x.x.x.vsix
- Open VS Code
- Press
Ctrl+Shift+P → "Extensions: Install from VSIX..."
- Select downloaded
.vsix file
From Marketplace
Search for "Pseudocode Sobol" in VS Code Extensions (Ctrl+Shift+X)
Usage
Create Algorithm File
Ctrl+Shift+N → New algorithm file
- Or create file with
.alg extension
- Start typing snippets (
alg, for, if, etc.)
Validate Syntax
- Open
.alg file
Ctrl+Shift+V → Validate syntax
- Check Output panel for errors
In Markdown
- Create code block with
```pseudocode
- Write algorithm with syntax highlighting
- Type
pseudocode + Tab for template
Requirements
- VS Code 1.75.0 or higher
- No external dependencies
Extension Settings
This extension contributes:
- Language:
pseudocode (.alg files)
- File associations:
*.alg → pseudocode
- Commands: 3 commands (validate, insert arrow, new file)
- Keybindings: 3 keyboard shortcuts
Known Issues
- Validation currently checks basic syntax only (algorithm structure, braces)
- No IntelliSense/autocompletion for custom variables yet
Release Notes
1.0.0
Initial release:
- Syntax highlighting for .alg files
- 27+ code snippets
- Markdown code block support
- Basic syntax validation
- Arrow insertion command
- Algorithm file templates
About
Created for students at Pedagogical University of Krakow using Mariusz Sobol's pseudocode notation.
Based on materials from: github.com/lkolo-prez/algorytmy
License
MIT License - see LICENSE file
Contributing
Issues and pull requests welcome at: github.com/lkolo-prez/algorytmy
Enjoy writing algorithms!
| |