| Crates.io | oak-pascal |
| lib.rs | oak-pascal |
| version | 0.0.1 |
| created_at | 2025-10-22 05:23:25.247267+00 |
| updated_at | 2026-01-23 04:43:12.01841+00 |
| description | Pascal programming language parser with support for structured programming and modern Pascal dialects. |
| homepage | https://github.com/ygg-lang/oaks |
| repository | https://github.com/ygg-lang/oaks |
| max_upload_size | |
| id | 1895000 |
| size | 786,162 |
High-performance incremental Pascal parser for the oak ecosystem with flexible configuration, optimized for legacy code analysis and educational purposes.
Oak Pascal is a robust parser for Pascal, designed to handle complete Pascal syntax including legacy and modern features. Built on the solid foundation of oak-core, it provides both high-level convenience and detailed AST generation for code analysis and educational purposes.
Basic example:
use oak_pascal::{Parser, PascalLanguage, SourceText};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let parser = Parser::new();
let source = SourceText::new(r#"
program HelloWorld;
begin
writeln('Hello, World!');
end.
"#);
let result = parser.parse(&source);
println!("Parsed Pascal successfully.");
Ok(())
}
use oak_pascal::{Parser, PascalLanguage, SourceText};
let parser = Parser::new();
let source = SourceText::new(r#"
program Calculator;
uses
SysUtils;
var
x, y: integer;
begin
x := 10;
y := 20;
writeln(x + y);
end.
"#);
let result = parser.parse(&source);
println!("Program parsed successfully.");
use oak_pascal::{Parser, PascalLanguage, SourceText};
let parser = Parser::new();
let source = SourceText::new(r#"
procedure Greet(name: string);
begin
writeln('Hello, ', name);
end;
"#);
let result = parser.parse(&source);
println!("Procedure parsed successfully.");
use oak_pascal::{Parser, PascalLanguage, SourceText};
let parser = Parser::new();
let source = SourceText::new("program Test; begin end.");
let result = parser.parse(&source);
println!("Token parsing completed.");
use oak_pascal::{Parser, PascalLanguage, SourceText};
let parser = Parser::new();
let source = SourceText::new(r#"
program Test
begin
writeln('Missing semicolon')
end.
"#);
let result = parser.parse(&source);
if let Some(errors) = result.result.err() {
println!("Parse errors found: {:?}", errors);
} else {
println!("Parsed successfully.");
}
The parser generates a comprehensive AST with the following main structures:
Oak Pascal integrates seamlessly with:
Check out the examples directory for comprehensive examples:
Contributions are welcome!
Please feel free to submit pull requests at the project repository or open issues.