# Welcome to twinBASIC

twinBASIC is a new BASIC language and development environment aiming for 100% backward compatibility with VB6 and VBA, while adding modern language features --- generics, native [**Interface**](/twinBASIC-docs/tB/Core/Interface.md) and [**CoClass**](/twinBASIC-docs/tB/Core/CoClass.md) declarations, attributes, and a package system. The compiler and IDE are under active development and currently in beta; the [FAQ](/twinBASIC-docs/FAQ.md) covers the project's status, authorship, and what is and isn't implemented today, and downloads live on the [Releases](https://github.com/twinbasic/twinbasic/releases) page of the main GitHub repository.

## New to twinBASIC?

Start with the [FAQ](/twinBASIC-docs/FAQ.md) for orientation --- what twinBASIC is, where it stands today, and what runs on it --- then the [Features overview](/twinBASIC-docs/Features/index.md) for a tour of everything the language adds on top of VBx. The [Tutorials](#tutorials) section below has step-by-step guides; the [Arrays](/twinBASIC-docs/Tutorials/Arrays.md) tutorial assumes no prior twinBASIC experience and is a reasonable first read.

## Coming from VBA or VB6?

Most existing VB6 / VBA code compiles unchanged. Key additions beyond VBx compatibility: new data types ([**LongLong**](/twinBASIC-docs/Features/Language/Data-Types.md#longlong), [**LongPtr**](/twinBASIC-docs/Features/Language/Data-Types.md#longptr), [**Decimal**](/twinBASIC-docs/Features/Language/Data-Types.md#decimal)), native [**Interface**](/twinBASIC-docs/tB/Core/Interface.md) and [**CoClass**](/twinBASIC-docs/tB/Core/CoClass.md) declarations, [**Implements Via**](/twinBASIC-docs/Features/Language/Inheritance.md#implements-via-for-basic-inheritance) and [**Inherits**](/twinBASIC-docs/Features/Language/Inheritance.md#inherits-for-complete-oop) for inheritance, generics, method overloading, type inference, and attribute syntax. The [Features overview](/twinBASIC-docs/Features/index.md) is the complete catalogue.

## Faster and smaller programs with LLVM

twinBASIC can compile a project with LLVM, an optimizing compiler back end built into the IDE. [Getting Started with LLVM](/twinBASIC-docs/LLVM/Getting-Started.md) covers turning it on for a project or for a single procedure, the options that control it, and its current limitations.

## Looking up a keyword, function, or operator?

The reference section is split into language constructs (the things the compiler parses) and runtime members (functions, properties, types, classes shipped in the built-in packages):

- [**Categorical list**](/twinBASIC-docs/Reference/Categories.md) --- statements, procedures, and functions grouped by purpose (compiler control, declarations, control flow, file I/O, ...)
- [**Statements**](/twinBASIC-docs/Reference/Statements.md) --- alphabetical index of every language statement
- [**Procedures and Functions**](/twinBASIC-docs/Reference/Procedures-and-Functions.md) --- alphabetical index of every callable runtime member
- [**Operators**](/twinBASIC-docs/Reference/Operators.md) --- arithmetic, comparison, logical, bitwise, and twinBASIC's added operators
- [**Compiler Constants**](/twinBASIC-docs/Reference/Compiler-Constants.md) --- the `#If` symbols recognised by the compiler
- [**Attributes**](/twinBASIC-docs/tB/Core/Attributes.md) --- `[Description(...)]`, `[COMCreatable(...)]`, and the rest of the attribute syntax
- [**Controls**](/twinBASIC-docs/tB/Controls.md) --- the standard UI controls ([**CheckBox**](/twinBASIC-docs/tB/Packages/VB/CheckBox/index.md), [**TextBox**](/twinBASIC-docs/tB/Packages/VB/TextBox/index.md), [**CommandButton**](/twinBASIC-docs/tB/Packages/VB/CommandButton/index.md), ...) grouped by purpose
- [**Glossary**](/twinBASIC-docs/tB/Gloss.md) --- technical terms used across the docs

## Built-in packages

A *package* groups related code under one namespace and is referenced from a project as a single dependency. The [Packages page](/twinBASIC-docs/tB/Packages/index.md) lists every built-in package with a one-line description; the headings below group them by what they are for.

**Default packages** --- referenced in every project automatically:

- [**VBA**](/twinBASIC-docs/tB/Packages/VBA.md) --- the standard runtime library (`MsgBox`, `CStr`, `Format`, `Mid`, ...) plus the [**Collection**](/twinBASIC-docs/tB/Modules/Collection/index.md) and [**Err**](/twinBASIC-docs/tB/Modules/Information/Err.md) intrinsics
- [**VBRUN**](/twinBASIC-docs/tB/Packages/VBRUN/index.md) --- runtime types ([**PropertyBag**](/twinBASIC-docs/tB/Packages/VBRUN/PropertyBag/index.md), ambient properties, structured error context, drag-and-drop) and the enumerations used by classic VB6 forms and controls
- [**VB**](/twinBASIC-docs/tB/Packages/VB/index.md) --- the standard controls ([**CheckBox**](/twinBASIC-docs/tB/Packages/VB/CheckBox/index.md), [**TextBox**](/twinBASIC-docs/tB/Packages/VB/TextBox/index.md), [**CommandButton**](/twinBASIC-docs/tB/Packages/VB/CommandButton/index.md), ...) and the application-level singletons ([**App**](/twinBASIC-docs/tB/Packages/VB/App/index.md), [**Screen**](/twinBASIC-docs/tB/Packages/VB/Screen/index.md), [**Clipboard**](/twinBASIC-docs/tB/Packages/VB/Clipboard/index.md), [**Printer**](/twinBASIC-docs/tB/Packages/VB/Printer/index.md), ...)

**Additional GUI** --- controls beyond the [**VB**](/twinBASIC-docs/tB/Packages/VB/index.md) package:

- [**CustomControls**](/twinBASIC-docs/tB/Packages/CustomControls/index.md) --- owner-drawn `Waynes…` controls with a DESIGNER framework for authoring new ones
- [**WinNativeCommonCtls**](/twinBASIC-docs/tB/Packages/WinNativeCommonCtls/index.md) --- VB6-compatible replacement for `MSCOMCTL.OCX` ([**DTPicker**](/twinBASIC-docs/tB/Packages/WinNativeCommonCtls/DTPicker.md), [**ImageList**](/twinBASIC-docs/tB/Packages/WinNativeCommonCtls/ImageList/index.md), [**ListView**](/twinBASIC-docs/tB/Packages/WinNativeCommonCtls/ListView/index.md), [**MonthView**](/twinBASIC-docs/tB/Packages/WinNativeCommonCtls/MonthView.md), [**ProgressBar**](/twinBASIC-docs/tB/Packages/WinNativeCommonCtls/ProgressBar.md), [**Slider**](/twinBASIC-docs/tB/Packages/WinNativeCommonCtls/Slider.md), [**TreeView**](/twinBASIC-docs/tB/Packages/WinNativeCommonCtls/TreeView/index.md), [**UpDown**](/twinBASIC-docs/tB/Packages/WinNativeCommonCtls/UpDown.md))

**Web embedding** --- host a browser engine inside a form:

- [**WebView2**](/twinBASIC-docs/tB/Packages/WebView2/index.md) --- the Microsoft Edge runtime
- [**CEF**](/twinBASIC-docs/tB/Packages/CEF/index.md) --- the Chromium Embedded Framework (BETA), with a choice of three Chromium runtimes

**Windows integration** --- thin wrappers over OS facilities:

- [**WinServicesLib**](/twinBASIC-docs/tB/Packages/WinServicesLib/index.md) --- run a twinBASIC EXE as one or more Windows services
- [**WinEventLogLib**](/twinBASIC-docs/tB/Packages/WinEventLogLib/index.md) --- write Windows Event Log entries, with compile-time message-table generation
- [**WinNamedPipesLib**](/twinBASIC-docs/tB/Packages/WinNamedPipesLib/index.md) --- IOCP-based asynchronous named-pipe server and client

**Tooling**:

- [**Assert**](/twinBASIC-docs/tB/Packages/Assert/index.md) --- assertion functions for unit tests, in three modules sharing the same fifteen-member API at different strictness levels
- [**tbIDE**](/twinBASIC-docs/tB/Packages/tbIDE/index.md) --- the addin SDK for the twinBASIC IDE itself

## Tutorials

Step-by-step guides, the first four written for someone new to twinBASIC. [Tutorials](/twinBASIC-docs/Tutorials/index.md) lists them all.

- [**Hello World**](/twinBASIC-docs/Tutorials/Hello-World.md) --- a first Standard EXE: a form, a button and one line of code
- [**Forms basics**](/twinBASIC-docs/Tutorials/Forms.md) --- controls, the Properties window and common events, building a temperature converter
- [**Calling the Windows API**](/twinBASIC-docs/Tutorials/Windows-API.md) --- `Declare` statements, `PtrSafe` and `LongPtr`, and reading error information
- [**Writing unit tests with Assert**](/twinBASIC-docs/Tutorials/Testing-with-Assert.md) --- test Subs, running them from the CodeLens bar, and testing error paths
- [**Arrays**](/twinBASIC-docs/Tutorials/Arrays.md) --- fixed and dynamic arrays, `Dim`, `ReDim`, multi-dimensional shapes
- [**CustomControls**](/twinBASIC-docs/Tutorials/CustomControls/index.md) --- building owner-drawn controls with the `Waynes…` framework
- [**WebView2**](/twinBASIC-docs/Tutorials/WebView2/index.md) --- embedding the Edge runtime: hosting local assets, JavaScript interop, driving Monaco
- [**CEF**](/twinBASIC-docs/Tutorials/CEF/index.md) --- embedding Chromium: building a browser shell, hosting local assets, JavaScript interop, driving Monaco

## The twinBASIC IDE

The [**IDE section**](/twinBASIC-docs/tB/IDE.md) documents the [code editor and the panels beside it](/twinBASIC-docs/tB/IDE/Code/index.md) (diagnostics, find, outline), the project explorer, [running and debugging](/twinBASIC-docs/tB/IDE/Debugging/index.md) (breakpoints, call stack, watches, debug console), the [**form designer**](/twinBASIC-docs/tB/IDE/Forms/index.md) and [**report designer**](/twinBASIC-docs/tB/IDE/Reports/index.md), and the per-feature side panes. To install third-party addins, see [**Add Ins**](/twinBASIC-docs/tB/IDE/AddIns/index.md); to author your own, the [**tbIDE package**](/twinBASIC-docs/tB/Packages/tbIDE/index.md) is the addin SDK.

## Community and external resources

- The [**Community**](/twinBASIC-docs/Community/index.md) section lists what twinBASIC users write and share: [packages](/twinBASIC-docs/tB/Packages/Contributed/index.md), [add-ins](/twinBASIC-docs/Community/Add-Ins.md) for the IDE, [tools](/twinBASIC-docs/Community/Tools.md) and guides. It also says where the community meets.
- [**Videos**](/twinBASIC-docs/Videos.md) --- the twinBASIC video series and the [**Access DevCon**](/twinBASIC-docs/Videos/AccessDevCon.md) conference sessions.

## Reading offline

This whole site is also available as a PDF book and as an offline copy that opens in any
browser: see [**Read offline**](/twinBASIC-docs/Downloads.md#read-offline) on the Downloads page.

## Contributing to the documentation

These docs are open source. See [**Documentation Development**](/twinBASIC-docs/Documentation/Development/index.md) for the build and preview workflow plus the contribution conventions.
