How opensourcecobol/opensourcecobol4j works
Project type and purpose
• This is a source‐to‐source compiler (“opensource COBOL 4J”) that translates COBOL code into Java.
• It contains:
• A C‐based compiler front‐end and back‐end (cobj, parser, codegen)
• A Java runtime library (libcobj) packaged as a JAR
• Auxiliary tools: cobj‐idx (indexed-file utility), cobj‐api (Spring Boot code generator)
• Test suites (NIST COBOL 85) and CI/CD pipelines (GitHub Actions, Docker, .devcontainer)
File structure
• Top‐level C compiler:
• cobj/ – scanner (Flex), parser (Bison), AST, semantic checks, code generator modules
• compile_libcobj.sh, Makefile.am/in, configure, autoconf scripts
• lib/ – C support libraries (getopt, gettext), headers (libcobj.h)
• Java runtime:
• libcobj/ – Gradle Kotlin build, Java packages (common, data, file, termio, ui, exceptions, user_util)
• libcobj/app – the main Spring Boot cobj‐api tool
• gradlew, settings.gradle.kts, wrapper files
• CLI tools:
• bin/ – shell wrappers, cobjrun.c
• libcobj/bin – cobj‐api, cobj‐idx executable scripts
• Configuration, docs, CI:
• .devcontainer/ – VS Code remote container setup
• .github/workflows/ – build/test/static analysis pipelines
• doc/ – architecture notes, API references
• tests/ – extensive NIST COBOL85 test inputs and makefiles
• win/ – Visual Studio solution and PowerShell scripts
README for additional insights
• The README confirms:
• Compiler front‐end (C) → produces Java source + class
• Runtime library (libcobj.jar) loaded by JVM
• cobj‐idx for indexed file operations
• cobj‐api for generating Spring Boot callers
• Build & install instructions for Linux, Windows, Docker
• CI testing against NIST COBOL85 suite
Detail
• Every essential artifact: cobj binary, .java outputs, libcobj.jar, generated .class, cobj‐idx, cobj‐api, test suite.
• Do not over‐abstract: show scanner.l → parser.y, AST modules, codegen.c, config files.