Skip to content

Complete the C++ migration's runtime, tests, and compiler metadata #14

Closed

Description

@ewanc26

Summary

Selenium's README describes a C++/CMake compiler, but several repository components still describe or invoke the previous Python compiler, and the checked-in C++ CLI references a runtime source file that is absent from the repository.

Findings on main

  • README.md describes a C++ compiler and the CMake build produces build/seleniumc.
  • CONTRIBUTING.md still identifies Python as the primary language.
  • src/cli/main.cpp asks CMake for runtime/selenium_runtime.c, yet the default-branch tree contains no runtime/ directory. The CLI always appends this nonexistent file to generated C, so the documented compiler flow is not reproducible.
  • --run uses fixed /tmp/selenium_out.c and /tmp/selenium_out paths and concatenates unquoted compiler and file paths into a shell command.
  • The Python differential and example test harnesses invoke python -m selenium.main; the Python frontend is no longer present, so they do not exercise the C++ executable.
  • src/sema/sema.cpp is a no-op placeholder.
  • The current CI build completes but the unit-test step fails at parser hello with “unexpected token in expression at line 1”.
  • The shared capability matrix claims tested feature coverage, but CI does not check the Selenium matrix against actual files/tests.

Acceptance criteria

  • Restore the C runtime helpers required by emitted C.
  • Replace fixed temporary paths and shell-unsafe command assembly in --run; validate CLI options and file failures.
  • Port differential/example tests to invoke build/seleniumc, not the removed Python package.
  • Fix the parser unit test's dangling source reference and run unit plus CLI smoke tests through CTest/CI.
  • Reconcile CMake, README, CONTRIBUTING, AGENTS, runtime paths, and capabilities.json with the real implementation.
  • Implement actual semantic validation or clearly mark unsupported/unchecked guarantees.

Until these changes land, the C++ migration's build/reference status is not fully reliable.

Progress update (2026-10-25)

PR #15 restores the missing runtime, hardens --run, adds CTest CLI smoke coverage, and fixes the parser test's dangling reference to a temporary std::string. The CMake build, unit tests, and first CLI smoke run passed in CI; an expanded numeric-output smoke test is running now. The full differential harness migration, shared capability-matrix correction, and semantic-analysis implementation remain open.

Follow-up progress (2026-10-25)

PR #15 now embeds the checked-in runtime helpers directly into generated C rather than emitting an absolute path into the source checkout. The smoke suite compiles and runs the generated C from a separate path; CI passes with the standalone-generated-C regression test. Full differential coverage and semantic analysis remain outstanding.

Semantic-analysis follow-up (2026-10-25)

PR #15 replaces the no-op semantic-analysis pass with initial checks for undeclared variable references, duplicate variables and parameters, nested variable scope, break/continue, and return outside a function. Tests also cover scope exit and invalid control-flow context. Full type compatibility, call signatures, lvalue validation, label/goto resolution, and differential parity remain open; CI is rerunning for the expanded tests.

Function-call validation follow-up (2026-10-25)

PR #15 now also validates that calls refer to declared functions, supports forward/recursive calls through a declaration prepass, rejects conflicting parameter counts across declarations, and checks call argument counts. The expanded unit tests and standalone-generated-C smoke suite pass in CI run 40241177371.

Return-value semantic checks (2026-10-25)

PR #15 now rejects value returns from void functions and bare returns from non-void functions. The expanded semantic tests pass CI (run 40242591967). Type compatibility and complete return-path analysis remain outstanding.

Goto and label validation (2026-10-26)

PR #15 now pre-collects labels within each function, rejects duplicate labels, and diagnoses gotos to missing labels or labels in another function. Unit tests cover valid targets, missing targets, duplicates, and cross-function isolation. The expanded unit tests and CLI smoke suite pass in CI run 40250290207. Type compatibility, lvalue checks, and complete return-path analysis remain outstanding.

Duplicate function definition checks (2026-10-26)

PR #15 now distinguishes prototypes from definitions and rejects multiple definitions of the same function while still allowing a prototype followed by a definition. A targeted semantic-analysis test covers duplicate definitions. The expanded suite passes in CI run 40251372567.

Activity

  1. ewanc26 commented on Oct 26, 2026

    @ewanc26
    OwnerAuthor

    Addressed runtime embedding, hardened CLI, updated tests to use build/seleniumc, updated docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions