# 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**](/tB/Core/Interface.md) and [**CoClass**](/tB/Core/CoClass.md) declarations, attributes, and a package system. The compiler and IDE are under active development and currently in beta; the [FAQ](/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](/FAQ.md) for orientation --- what twinBASIC is, where it stands today, and what runs on it --- then the [Features overview](/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](/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**](/Features/Language/Data-Types.md#longlong), [**LongPtr**](/Features/Language/Data-Types.md#longptr), [**Decimal**](/Features/Language/Data-Types.md#decimal)), native [**Interface**](/tB/Core/Interface.md) and [**CoClass**](/tB/Core/CoClass.md) declarations, [**Implements Via**](/Features/Language/Inheritance.md#implements-via-for-basic-inheritance) and [**Inherits**](/Features/Language/Inheritance.md#inherits-for-complete-oop) for inheritance, generics, method overloading, type inference, and attribute syntax. The [Features overview](/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](/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**](/Reference/Categories.md) --- statements, procedures, and functions grouped by purpose (compiler control, declarations, control flow, file I/O, ...)
- [**Statements**](/Reference/Statements.md) --- alphabetical index of every language statement
- [**Procedures and Functions**](/Reference/Procedures-and-Functions.md) --- alphabetical index of every callable runtime member
- [**Operators**](/Reference/Operators.md) --- arithmetic, comparison, logical, bitwise, and twinBASIC's added operators
- [**Compiler Constants**](/Reference/Compiler-Constants.md) --- the `#If` symbols recognised by the compiler
- [**Attributes**](/tB/Core/Attributes.md) --- `[Description(...)]`, `[COMCreatable(...)]`, and the rest of the attribute syntax
- [**Controls**](/tB/Controls.md) --- the standard UI controls ([**CheckBox**](/tB/Packages/VB/CheckBox/index.md), [**TextBox**](/tB/Packages/VB/TextBox/index.md), [**CommandButton**](/tB/Packages/VB/CommandButton/index.md), ...) grouped by purpose
- [**Glossary**](/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](/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**](/tB/Packages/VBA.md) --- the standard runtime library (`MsgBox`, `CStr`, `Format`, `Mid`, ...) plus the [**Collection**](/tB/Modules/Collection/index.md) and [**Err**](/tB/Modules/Information/Err.md) intrinsics
- [**VBRUN**](/tB/Packages/VBRUN/index.md) --- runtime types ([**PropertyBag**](/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**](/tB/Packages/VB/index.md) --- the standard controls ([**CheckBox**](/tB/Packages/VB/CheckBox/index.md), [**TextBox**](/tB/Packages/VB/TextBox/index.md), [**CommandButton**](/tB/Packages/VB/CommandButton/index.md), ...) and the application-level singletons ([**App**](/tB/Packages/VB/App/index.md), [**Screen**](/tB/Packages/VB/Screen/index.md), [**Clipboard**](/tB/Packages/VB/Clipboard/index.md), [**Printer**](/tB/Packages/VB/Printer/index.md), ...)

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

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

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

- [**WebView2**](/tB/Packages/WebView2/index.md) --- the Microsoft Edge runtime
- [**CEF**](/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**](/tB/Packages/WinServicesLib/index.md) --- run a twinBASIC EXE as one or more Windows services
- [**WinEventLogLib**](/tB/Packages/WinEventLogLib/index.md) --- write Windows Event Log entries, with compile-time message-table generation
- [**WinNamedPipesLib**](/tB/Packages/WinNamedPipesLib/index.md) --- IOCP-based asynchronous named-pipe server and client

**Tooling**:

- [**Assert**](/tB/Packages/Assert/index.md) --- assertion functions for unit tests, in three modules sharing the same fifteen-member API at different strictness levels
- [**tbIDE**](/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](/Tutorials/index.md) lists them all.

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

## The twinBASIC IDE

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

## Community and external resources

- The [**twinBASIC wiki**](https://github.com/twinbasic/documentation/wiki) on GitHub supplements these docs with community contributions and notes on bleeding-edge features.
- [**Videos**](/Videos.md) --- the twinBASIC video series and the [**Access DevCon**](/Videos/AccessDevCon.md) conference sessions.
- Third-party guides by Mike Wolfe at [@nolongerset](https://nolongerset.com):
  - [Create a Custom ActiveX Control with twinBASIC](https://nolongerset.com/create-activex-control-with-twinbasic/)
  - [Create a Tool Window in the VBIDE with twinBASIC](https://nolongerset.com/create-a-vbe-addin-with-twinbasic/)

## 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**](/Downloads.md#read-offline) on the Downloads page.

## Contributing to the documentation

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