Skip to content

Installation and your first program

The NeoObjectPascal interpreter is distributed as an executable JAR file, so all you need is Java 11 or later installed.

Prerequisites

  • Java 11+ (JRE or JDK). Check with:
bash
java -version
  • (Optional) Maven, if you want to build the interpreter from source.

Getting the interpreter

You can use the pre-packaged JAR (for example, the one that ships with the VS Code extension, in VS-Code-Extension/bin/) or build it from the repository:

bash
cd NeoObjectPascal
mvn package -DskipTests
# The final JAR is in target/neoobjectpascal-1.0-SNAPSHOT-jar-with-dependencies.jar

Hello, world

Create a file named ola.npas:

npas
begin
    WriteLn("Olá, NeoObjectPascal!");
end.

And run it:

bash
java -jar neoobjectpascal.jar ola.npas
Saída
 Olá, NeoObjectPascal! 

File extension

Programs use the .npas extension. Test files use .test.npas.

Command-line options

The interpreter accepts several flags:

FlagDescription
(none)Runs the .npas file
-q, --no-warningsSuppresses analysis warnings
-t, --testTest mode (runs a .test.npas)
-ta, --test-all <dir>Runs all tests recursively, with coverage
-d, --debugInteractive debugger mode
--dapDAP mode (VS Code integration)
--build <file> [--icon png] [--name] [--output] [--target]Builds a native executable (exe/app/bin)
--execute-on-cloud <url> <proj> <user> <pass>Runs on NeoObjectPascalCloud
-h, --helpShows help

Examples:

bash
java -jar neoobjectpascal.jar --no-warnings ola.npas
java -jar neoobjectpascal.jar -t calculadora.test.npas
java -jar neoobjectpascal.jar --test-all ./examples

Recommended editor

Install the VS Code extension for NeoObjectPascal and get syntax highlighting, execution, testing, and debugging all integrated. See Debugger, VS Code, and cloud.

Now that you can run code, let's understand the structure of a program.