# DVX BASIC

A Visual Basic 3 clone for the DVX GUI system.  Provides a visual form
designer, per-procedure code editor, project management, and a stack-
based bytecode compiler and VM for running event-driven BASIC programs.

## Documentation

For BASIC authors, the complete user reference is split across several
`.dhs` help sources in this directory, all compiled into the DVX BASIC
Reference:

- `langref.dhs`  -- language reference: data types, keywords, operators,
  control flow, built-in functions, I/O, error codes.
- `ideguide.dhs` -- IDE guide: menus, toolbar, project model, form
  designer, code editor, debugger, preferences.
- `ctrlover.dhs` -- control overview: common widget properties and
  events from a BASIC author's perspective.
- `form.dhs`     -- form lifecycle, properties, events.
- `basrt.dhs`    -- BASIC runtime reference: DECLARE LIBRARY mechanism,
  shipped include files.

After `make`, the compiled form is `bin/apps/kpunch/dvxbasic/dvxbasic.hlp`
(viewable via the Help Viewer app or from within the IDE via F1) and
`docs/dvx_basic_reference.html`.

## Subdirectories (for maintainers)

- `compiler/` -- lexer, parser, codegen, symbol table, opcodes.
  Single-pass compiler that translates BASIC source to stack-based
  p-code.
- `runtime/`  -- VM and tagged value system (values.c, vm.c, serialize.c).
- `formrt/`   -- form runtime, the bridge between the BASIC VM and the
  DVX widget system.
- `ide/`      -- the IDE itself (main, designer, project, properties,
  toolbox, menu editor).
- `stub/`     -- `basstub` (runtime loader for compiled BASIC `.app`
  files) and `bascomp` (standalone command-line compiler).

## Project Files

    project.dbp       INI-format project file
    module.bas        BASIC module (code only)
    form.frm          Form file (layout + code after the form's End)

`.bas` modules compile before `.frm` code sections, so CONST
declarations are visible to form event handlers.

## Build

    make -C src/apps/kpunch/dvxbasic        # cross-compile for DOS
    make -C src/apps/kpunch/dvxbasic tests  # build native test programs

Test programs: `test_compiler`, `test_vm`, `test_lex`, `test_quick`,
`test_compact`, `test_suite`.
