DEV Community

ahoNerd
ahoNerd

Posted on • Originally published at ahonerd.com on

Run and Compile Pascal with Sublime Text

Cara menjalankan dan kompilasi Pascal dengan menggunakan Sublime Text 3.

Prerequisite

Build System

Buka Sublime Text 3, kemudian pilih menu ToolsBuild System
New Build System...

Build System

Akan muncul template Build System untuk kemudian kita ganti isinya menjadi seperti berikut:

{
"shell": true,
"cmd": ["fpc", "${file_path}/${file_base_name}", "&&", "start", "cmd", "/c", "$file_base_name.exe", "&", "pause"],
"selector": "source.pascal",
"variants": [
{
"cmd": ["start", "cmd", "/c", "$file_base_name.exe & pause"],
"name": "Run",
"shell": true
},
{
"cmd": ["fpc", "${file_path}/${file_base_name}"],
"name": "Compile",
"shell": true
}
]
}

Lalu simpan dengan nama Pascal.sublime-build

Pastikan bahwa yang dirubah hanya nama file-nya saja dan biarkan extension tetap .sublime-build

Testing

Untuk mencoba instalasi di atas, kita buat program sederhana seperti berikut:

program coba;
begin
writeln('Konnichiwa!');
readln();
end.
view raw test.pas hosted with ❤ by GitHub

readln() diperlukan agar Command Prompt yang muncul tidak langsung tertutup.
Simpan file dengan extension .pas

Kemudian pilih menu ToolsBuild SystemPascal.

Build System

Lalu pilih menu ToolsBuild With..., atau dengan shortcut Ctrl+Shift+B maka akan muncul tampilan seperti berikut:

Build With

Pilih Pascal - Compile, lalu ulangi pilih menu ToolsBuild With..., atau dengan shortcut Ctrl+Shift+B, tapi kali ini pilih Pascal - Run, maka akan muncul terminal berisi text 'Konnichiwa!', seperti berikut:

CMD

Ketika kita menjalankan Pascal - Compile, hasil kompilasi akan tersimpan pada direktori yang sama dengan source file.

Reference

Tutorial ini dibuat berdasarkan referensi dari forum.lazarus.freepascal.org.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay