惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
博客园 - 司徒正美
I
InfoQ
宝玉的分享
宝玉的分享
G
Google Developers Blog
J
Java Code Geeks
Martin Fowler
Martin Fowler
The GitHub Blog
The GitHub Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
罗磊的独立博客
腾讯CDC
F
Fortinet All Blogs
A
About on SuperTechFans
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Recent Announcements
Recent Announcements
Last Week in AI
Last Week in AI
B
Blog RSS Feed
博客园 - 聂微东
D
DataBreaches.Net
Hugging Face - Blog
Hugging Face - Blog
The Cloudflare Blog
L
LangChain Blog
Microsoft Azure Blog
Microsoft Azure Blog
aimingoo的专栏
aimingoo的专栏

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
CrabPascal CLI: check, run, and build-exe | CLI: check, r...
CrabPascal · 2026-06-03 · via DEV Community

Bilingual post · Post bilíngue

Jump to: English · Português


English {#english}

CrabPascal CLI: check, run, and build-exe

The CrabPascal CLI (v2.22.0) exposes three commands that cover most daily workflows: validate code, execute it, or ship a native binary. Understanding when to use each saves time and avoids confusion about gcc dependencies.

Command overview

crab-pascal check  MyApp.dpr    # Analyze only — no execution
crab-pascal run    MyApp.dpr    # Execute via internal runtime
crab-pascal build-exe MyApp.dpr # Generate C + compile with gcc/clang

Enter fullscreen mode Exit fullscreen mode

There is also preproc for {$IFDEF} directives and parse for AST debugging.

check — fast feedback loop

Use check when you want diagnostics without side effects:

crab-pascal check examples/crud/crud.dpr

Enter fullscreen mode Exit fullscreen mode

Output follows the VS Code-friendly format:

crud.dpr:42:10: error: Unknown identifier 'FooBar'

Enter fullscreen mode Exit fullscreen mode

This runs the full frontend: lexer, parser, and semantic analyzer. Ideal for:

  • Pre-commit hooks
  • CI pipelines (crab-pascal check src/*.dpr)
  • Editor integration via the crabpascal.crabpascal extension

run — zero-dependency execution

run interprets your program through the internal runtime. No gcc required:

crab-pascal run examples/matematica/matematica.dpr

Enter fullscreen mode Exit fullscreen mode

Horse HTTP servers work here too:

crab-pascal run examples/crud/crud.dpr
# Server listens on port 9000
curl http://localhost:9000/produtos

Enter fullscreen mode Exit fullscreen mode

The runtime includes RTL shims (System.SysUtils, System.JSON, generics collections) loaded from rtl/ search paths.

build-exe — native binaries

When gcc or clang is available, build-exe emits C intermediate code and compiles it:

crab-pascal build-exe HelloWorld.dpr --output HelloWorld.exe
./HelloWorld.exe

Enter fullscreen mode Exit fullscreen mode

Without a C compiler, CrabPascal tells you explicitly — use run instead. This dual-mode design is intentional: develop with run, ship with build-exe.

Practical workflow

A typical session:

# 1. Edit code
# 2. Validate
crab-pascal check MyApp.dpr

# 3. Run tests
crab-pascal run MyApp.dpr

# 4. Optional: ship
crab-pascal build-exe MyApp.dpr --output bin/MyApp.exe

Enter fullscreen mode Exit fullscreen mode

For batch builds on Windows:

$projects = @("App1", "App2")
foreach ($p in $projects) {
  crab-pascal check "$p.dpr"
  crab-pascal build-exe "$p.dpr" --output "bin\$p.exe"
}

Enter fullscreen mode Exit fullscreen mode

preproc — conditional compilation

Delphi projects often use preprocessor directives:

{$IFDEF DEBUG}
  WriteLn('Debug mode');
{$ENDIF}

Enter fullscreen mode Exit fullscreen mode

Expand them before inspection:

crab-pascal preproc MyApp.dpr > MyApp.expanded.pas

Enter fullscreen mode Exit fullscreen mode

Configure symbols in crabpascal.toml under [preprocessor].

Tips

  • Add the binary to PATH or configure the VS Code extension path setting.
  • Use crab-pascal --version to confirm v2.22.0 in CI logs.
  • When check passes but run fails, report it — runtime parity is an active sprint goal.

The CLI is the backbone of CrabPascal. Master these three commands and you can develop Pascal anywhere a terminal runs.


Português {#portugus}

CLI do CrabPascal: check, run e build-exe

A CLI do CrabPascal (v2.22.0) expõe três comandos que cobrem a maior parte do dia a dia: validar código, executá-lo ou gerar binário nativo. Saber quando usar cada um economiza tempo e evita confusão sobre dependências do gcc.

Visão geral dos comandos

crab-pascal check  MyApp.dpr    # Só analisa — não executa
crab-pascal run    MyApp.dpr    # Executa via runtime interno
crab-pascal build-exe MyApp.dpr # Gera C + compila com gcc/clang

Enter fullscreen mode Exit fullscreen mode

Há também preproc para diretivas {$IFDEF} e parse para debug da AST.

check — loop de feedback rápido

Use check quando quiser diagnósticos sem efeitos colaterais:

crab-pascal check examples/crud/crud.dpr

Enter fullscreen mode Exit fullscreen mode

A saída segue o formato amigável ao VS Code:

crud.dpr:42:10: error: Unknown identifier 'FooBar'

Enter fullscreen mode Exit fullscreen mode

Isso executa todo o frontend: lexer, parser e analisador semântico. Ideal para:

  • Hooks de pre-commit
  • Pipelines de CI (crab-pascal check src/*.dpr)
  • Integração com a extensão crabpascal.crabpascal

run — execução sem dependências

O run interpreta seu programa pelo runtime interno. Não precisa de gcc:

crab-pascal run examples/matematica/matematica.dpr

Enter fullscreen mode Exit fullscreen mode

Servidores Horse HTTP também funcionam:

crab-pascal run examples/crud/crud.dpr
# Servidor na porta 9000
curl http://localhost:9000/produtos

Enter fullscreen mode Exit fullscreen mode

O runtime inclui shims RTL (System.SysUtils, System.JSON, coleções genéricas) carregados dos search paths em rtl/.

build-exe — binários nativos

Com gcc ou clang disponível, o build-exe emite C intermediário e compila:

crab-pascal build-exe HelloWorld.dpr --output HelloWorld.exe
./HelloWorld.exe

Enter fullscreen mode Exit fullscreen mode

Sem compilador C, o CrabPascal avisa explicitamente — use run. Esse design dual-mode é intencional: desenvolva com run, distribua com build-exe.

Fluxo prático

Uma sessão típica:

# 1. Editar código
# 2. Validar
crab-pascal check MyApp.dpr

# 3. Executar testes
crab-pascal run MyApp.dpr

# 4. Opcional: distribuir
crab-pascal build-exe MyApp.dpr --output bin/MyApp.exe

Enter fullscreen mode Exit fullscreen mode

Build em lote no Windows:

$projects = @("App1", "App2")
foreach ($p in $projects) {
  crab-pascal check "$p.dpr"
  crab-pascal build-exe "$p.dpr" --output "bin\$p.exe"
}

Enter fullscreen mode Exit fullscreen mode

preproc — compilação condicional

Projetos Delphi usam diretivas de pré-processador:

{$IFDEF DEBUG}
  WriteLn('Modo debug');
{$ENDIF}

Enter fullscreen mode Exit fullscreen mode

Expanda antes de inspecionar:

crab-pascal preproc MyApp.dpr > MyApp.expanded.pas

Enter fullscreen mode Exit fullscreen mode

Configure símbolos em crabpascal.toml na seção [preprocessor].

Dicas

  • Coloque o binário no PATH ou configure o caminho na extensão VS Code.
  • Use crab-pascal --version para confirmar v2.22.0 nos logs de CI.
  • Se check passa mas run falha, reporte — paridade do runtime é meta ativa de sprint.

A CLI é a espinha dorsal do CrabPascal. Domine esses três comandos e você desenvolve Pascal em qualquer lugar onde haja terminal.


Published on dev.to/@crabpascal · Código em CrabPascal