/porth-language

VSCode extension for the Porth language

Primary LanguageJavaScriptMIT LicenseMIT

Porth language for VSCode

GitHub repository: Porth language extension for VSCode

Features

This is a Visual Studio Code extension created by Tim Holzhey to add Porth language support.

Porth is an imperative, stack-based programming language. Porth is open-source and is currently being developed by Alexey Kutepov aka Tsoding.

Features:

  • Syntax highlighting (Grammar set)
  • Code snippets (Intrinsics and code blocks)
  • Compile and run commands
  • Integrated Porth compiler (submodule)
  • Jump to definition

Example

Usage

  1. Open a .porth file
  2. Open the Command Pallet (CTRL+SHIFT+P for Windows/Linux or CMD+SHIFT+P on Mac) and enter one of the supported commands:
    • Porth: Compile program
    • Porth: Run program

Make sure you have all required commands (python3, nasm, ld) added to $PATH.

Settings

  • porth.path: Path to the porth compiler (default: builtin)
  • porth.debug: Compiler debug flag (default: off)
  • porth.auto-run: Auto run the program after compiling (default: on)

Work in progress

Future features:

  • Test programs
  • Syntax error diagnostics
  • Context-based autocomplete suggestions
  • Parse references from all included files

Requirements

Unix x86 compiling (Linux)

  • Python 3
  • Netwide Assembler (NASM) x86
  • GNU linker

Windows 10 x86 compiling

  • Python 3
  • Install the Windows Subsystem for Linux (WSL) with: wsl --install to use the integrated GNU linker
  • Download and install the latest version of NASM for win64
  • Add NASM to $PATH (default: C:\Users\%user%\AppData\Local\bin\NASM) and restart