![]() |
This repository gathers Component Pascal code examples coming from various websites and books. It also includes several build scripts (batch files, Gradle scripts) for experimenting with Component Pascal on a Windows machine. |
Ada, Akka, C++, COBOL, Dafny, Dart, Deno, Erlang, Flix, Golang, GraalVM, Haskell, Kafka, Kotlin, LLVM, Modula-2, Node.js, Rust, Scala 3, Spark, Spring, Standard ML, TruffleSqueak, WiX Toolset and Zig are other topics we are continuously monitoring.
This project depends on the following external software for the Microsoft Windows platform:
- Gardens Point Component Pascal 1.4 1
- Git 2.51 (release notes)
- Temurin OpenJDK 17 LTS (release notes, bug fixes)
Optionally one may also install the following software:
☛ Installation policy
When possible we install software from a Zip archive rather than via a Windows installer. In our case we definedC:\opt\as the installation directory for optional software tools (in reference to the/opt/directory on Unix).
For instance our development environment looks as follows (October 2025) 2:
C:\opt\ConEmu\ ( 26 MB) C:\opt\Git\ (394 MB) C:\opt\gpcp-JVM-1.4.08\ ( 54 MB) C:\opt\gpcp-NET-1.4.08\ ( 22 MB) C:\opt\jdk-temurin-17.0.16_8\ (302 MB) C:\opt\VSCode\ (430 MB)
🔎 Git for Windows provides a BASH emulation used to run
git.exefrom the command line (as well as over 250 Unix commands likeawk,diff,file,grep,more,mv,rmdir,sedandwc).
Directory structure ▴
This project is organized as follows:
bin\ docs\ examples\{Hello, JvmParams, TypeParams, Vectors, etc.} rosetta-examples\{AryLen, etc.} README.md RESOURCES.md setenv.bat
where
- directory
bin\contains . - directory
docs\contains Component Pascal related documents. - directory
examples\contains Component Pascal code examples grabbed from various websites. - directory
rosetta-examples\contains Component Pascal code examples grabbed from the Rosetta Code website. - file
README.mdis the Markdown document for this page. - file
RESOURCES.mdgathers Component Pascal related informations. - file
setenv.batis the batch script for setting up our environment.
setenv.bat 4
> setenv -verbose Select drive G: for which a substitution already exists Tool versions: java 17.0.6, gpcp 1.4.08b3, j2cps 1.4.07, git 2.51.1, diff 3.12, bash 5.2.37(1)-release Tool paths: C:\opt\jdk-temurin-1.8.0u412-b08\bin\javac.exe C:\opt\jdk-temurin-17.0.16_8\bin\java.exe C:\opt\gpcp-NET-1.4.08\bin\gpcp.exe C:\opt\Git\bin\git.exe C:\opt\Git\usr\bin\diff.exe C:\opt\Git\bin\bash.exe Environment variables: "GIT_HOME=C:\opt\Git" "GPCP_HOME=C:\opt\gpcp-NET-1.4.08" "JAVA_HOME=C:\opt\jdk-temurin-17.0.16_8" "JROOT=C:\opt\gpcp-JVM-1.4.08" Path associations: H:\: => %USERPROFILE%\workspace-perso\component-pascal-examples
Footnotes ▴
[1] Garden Point Component Pascal for JVM ↩
-
GPCP for JVM version 1.4.07 supports JRE 8u272 or older.
Any newer version of Java VM will throw the exception
java.lang.ClassFormatError; for instance 8u282 :> set JAVA_HOME=c:\opt\jdk8u282-b08-jre > build -verbose -jvm clean compile Delete directory "target" Compile 1 Component Pascal source file to directory "H:\examples\Hello\target\classes" Exception in thread "main" java.lang.ClassFormatError: Illegal class name "LCP/CPJrts/XHR;" in class file CP/Visitor/Visitor_ImplementedCheck at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:756) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:473) at java.net.URLClassLoader.access$100(URLClassLoader.java:74) at java.net.URLClassLoader$1.run(URLClassLoader.java:369) at java.net.URLClassLoader$1.run(URLClassLoader.java:363) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:362) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) at CP.gpcp.gpcp.main(gpcp.cp:40) Error: Failed to compile 1 Component Pascal source file to directory "H:\examples\Hello\target\classes"
Fortunately, version 1.4.0.8 adds support for Java 11 and Java 17. Andras Pahi has hacked the GPCP compiler to emit local/stack declarations without semicolons. After JDK 1.8.0_275 the JVM follows the spec more rigorously and does not allow semicolons in class names.
[2] Downloads ↩
- In our case we downloaded the following installation files (see section 1):
-
ConEmuPack.230724.7z ( 5 MB) gpcp-JVM-1.4.08.zip ( 5 MB) gpcp-NET1.4.08b3.zip ( 4 MB) OpenJDK17U-jdk_x64_windows_hotspot_17.0.16_8.zip (188 MB) PortableGit-2.51.1-64-bit.7z.exe ( 47 MB) VSCode-win32-x64-1.105.1.zip (131 MB)
[4] setenv.bat usage ↩
-
Batch file
setenv.bathas specific environment variables set that enable us to use command-line developer tools more easily. - It is similar to the setup scripts described on the page "Visual Studio Developer Command Prompt and Developer PowerShell" of the Visual Studio online documentation.
-
For instance we can quickly check that the two scripts
Launch-VsDevShell.ps1andVsDevCmd.batare indeed available in our Visual Studio 2019 installation :> where /r "C:\Program Files (x86)\Microsoft Visual Studio" *vsdev* C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\Launch-VsDevShell.ps1 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\vsdevcmd\core\vsdevcmd_end.bat C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\vsdevcmd\core\vsdevcmd_start.bat
-
Concretely, in our GitHub projects which depend on Visual Studio (e.g.
michelou/cpp-examples),setenv.batdoes invokeVsDevCmd.bat(resp.vcvarall.batfor older Visual Studio versions) to setup the Visual Studio tools on the command prompt.
[5] GPCP command line options ↩
-
You shouldn't be misled by the help message of the hacked version 1.4.0.8 which still prints 1.4.0.7 :
> C:\opt\gpcp-JVM-1.4.08\bin\gpcp.bat -help gardens point component pascal: version 1.4.07 of 04 March 2018 #gpcp: Usage from the command line ... $ gpcp [cp-options] file {file} # CP Options ... General Options --- -copyright ==> Display copyright notice -dostats ==> Give a statistical summary -help ==> Write out this usage message -list ==> (default) Create *.lst file if errors -list+ ==> Unconditionally create *.lst file -list- ==> Don't create error *.lst file -quiet ==> Compile silently if possible -verbose ==> Emit verbose diagnostics -version ==> Write out version number -warn- ==> Don't emit warnings -nowarn ==> Don't emit warnings Environment Options --- -clsdir:XXX ==> Set class tree root in directory XXX -cpsym:XXX ==> Use environ. variable XXX instead of CPSYM -hsize:NNN ==> Set hashtable size >= NNN (0 .. 65000) -special ==> Compile dummy symbol file -strict ==> Disallow non-standard constructs Output Options --- -noasm ==> Don't create asm (or object) files -nocode ==> Don't create any object files -nosym ==> Don't create *.sym (or asm or object) files -symdir:XXX ==> Place symbol files in directory XXX -xmlerror ==> Emit error messages in XML format Code Generation Options --- -asm7 ==> Default: Generate class files with V1_7 format -asmN ==> Classfiles use V1_N format, N = (5 .. 8) -jasmin ==> Create jasmin asm files (but do not run Jasmin) -legacy ==> Use the pre-v1.4 jvm class writer -target:XXX ==> Emit (jvm|net) assembly # Java Options ... -D= pass to JRE as system property -DCPSYM=%CPSYM% pass value of CPSYM environment variable to JRE #gpcp: This program comes with NO WARRANTY #gpcp: Read source/GPCPcopyright for license details #gpcp: No input files specified
