Skip to content

About

BasicForge is an independent, native programming language that combines the readability of Visual Basic with the performance of compiled languages. It comes with its own: Compiler, Visual IDE & Runtime Library and Native Output.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BasicForge — Native Programming Language, Compiler Toolchain and Visual IDE

Project Codename: BasicForge
Project Type: Native Programming Language, Compiler Toolchain and Visual IDE
Initial Target: Windows 10/11 — x64
Compiler Implementation: C and C++
IDE Implementation: Rust
Output: Native Windows PE32+ executable (.exe)


Overview

BasicForge is a new, independent programming language and development environment combining:

  • The readability and simplicity of Visual Basic 6 and VB.NET.
  • The performance and control of native compiled languages.
  • The power of modern compiler optimization (via clang/LLVM).
  • A modern Visual Basic-inspired visual development environment.
  • Native Windows PE32+ executable generation.

BasicForge is not a wrapper around an existing compiler, nor a source-to-assembly translator. It has its own language frontend, semantic model, intermediate representation (IR), and native code-generation pipeline. The default backend emits C and compiles it with clang/lld-link; an optional LLVM C++ backend can be enabled when LLVM development headers are available.


Quick Start

Prerequisites

  • Windows 10 or Windows 11 (x64)
  • A C++ compiler (clang-cl or MSVC) for building bfc.exe
  • Rust toolchain (cargo, rustc) for building the IDE
  • LLVM/clang toolchain (clang.exe, lld-link.exe) — auto-detected

Building the Compiler (bfc.exe)

cd C:\Users\manshadi.PDF\Desktop\BasicForge\compiler
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBFC_BUILD_TESTS=ON
cmake --build build --config Release

LLVM is auto-detected. Set BFC_LLVM_ROOT (CMake) or BFC_LLVM_BIN (runtime, directory containing clang.exe/lld-link.exe) if LLVM is not in C:\Program Files\LLVM.

For the optional direct LLVM/LLD backend, install the LLVM development libraries and headers (LLVM.lib, LLD.lib, llvm/IR/Module.h); CMake then defines BFC_LLVM_HEADERS_AVAILABLE automatically. Without them, the compiler uses the C emission backend (clang + lld-link).

Running the Tests

cd C:\Users\manshadi.PDF\Desktop\BasicForge\compiler
ctest --test-dir build -C Release --output-on-failure

# End-to-end compile-and-run suite (hello, math, loops, classes, concat)
.\tests\run_tests.ps1

The suite covers lexer, parser, semantic analysis, IR, diagnostics, fuzz smoke tests and end-to-end compilation (including classes, methods, properties and VB-style & concatenation).

Building the IDE

cd C:\Users\manshadi.PDF\Desktop\BasicForge\ide
cargo build --release

Language Server

bfc ships a real LSP server for external editors:

{"command": "C:\\...\\BasicForge\\bfc.exe", "args": ["--lsp"]}

Supported: initialize, shutdown, full-text didOpen/didChange/didSave/ didClose with publishDiagnostics, keyword completion, hover and go-to-definition (symbol table built from the parser).

Forms (native Win32)

A Form declaration compiles to a real Win32 window with controls and event handlers:

Module Main
    Form MainForm
        Width = 640
        Height = 480
        Text = "My App"

        Button btnOK
            Text = "OK"
            Left = 20
            Top = 20
            Width = 100
            Height = 32
            OnClick = btnOK_Click
        End Button

        TextBox txt
            Text = "hello"
            Left = 20
            Top = 70
            Width = 200
            Height = 24
        End TextBox
    End Form

    Sub Main()
        Print(GetText("txt"))
    End Sub

    Sub btnOK_Click()
        Print("clicked")
    End Sub
End Module

Supported controls: Button, Label, TextBox, CheckBox, RadioButton, GroupBox, Panel, PictureBox, ListBox, ComboBox, TrackBar, ProgressBar, DateTimePicker, ListView, TreeView, RichTextBox, TabControl, ToolBar, StatusBar, UpDown. Events: OnClick (Click/CheckedChanged), OnDoubleClick, OnTextChanged, OnSelectedIndexChanged, OnValueChanged, OnAfterSelect, OnScroll, OnGotFocus, OnLostFocus, OnKeyDown, OnKeyUp, OnMouseMove, OnMouseEnter, OnMouseLeave, OnMouseWheel, OnPaint and OnDragDrop. GetText("name") / SetText("name", value) access controls by name. The IDE Form Designer generates this syntax directly.

Standard Library & SDKs

libraries/stdlib contains pure BasicForge modules. Include them inside a module (they contain only Sub/Function, not their own Module):

Module Main
    Include "math.bf"
    Include "string.bf"
    Include "array.bf"
    Include "file.bf"
    Include "date.bf"
    Include "console.bf"
    Include "json.bf"
    Include "csv.bf"
    Include "validation.bf"
    Include "random.bf"

    Sub Main()
        Print(Clamp(15, 0, 10))
        Print(IsPrime(97))
        Print(ToUpper("hello"))
    End Sub
End Module

Compile with -I libraries/stdlib. bfc.exe also searches libraries/ and libraries/stdlib/ relative to the executable automatically.

sdks/ contains Win32 wrappers (sdks/win32/win32.bf, sdks/win32/environment.bf) and JSON/CSV wrappers. Include is recursive and deduplicated, so wrappers can include stdlib modules safely.

Multi-target compilation

bfc.exe app.bf -o app.exe --target console    # console (default)
bfc.exe app.bf -o app.exe --target gui        # WinMain / windows subsystem
bfc.exe lib.bf -o lib.lib --target staticlib  # static library
bfc.exe lib.bf -o lib.dll --target sharedlib  # DLL (DllMain)

sharedlib uses the CRT aliases (/ALTERNATENAME) and ucrt.lib; a .def file can be added to export functions.

Debugger

The IDE debugger panel drives the native bfc debug through a pipe:

  • Start / Continue / Step / Stop buttons
  • Breakpoint list
  • Editable registers (setreg)
  • Disassembly view (disasm via llvm-objdump)
  • Call stack and live debug output

The CLI supports INT3 breakpoints (function or file:line), continue, single-step, backtrace, registers, globals and --script automation.

bfc.exe debug MyApp.exe
(bfdbg) break Main
(bfdbg) continue
(bfdbg) registers
(bfdbg) backtrace
(bfdbg) print MyGlobal
(bfdbg) quit

Supported: INT3 breakpoints by function or file:line, continue, single-step, backtrace, register inspection, global/address reads.

Compiling a BasicForge Program

# Compile a .bf source file to a PE32+ executable
bfc.exe examples\HelloWorld.bf -o HelloWorld.exe

# Run the generated executable
HelloWorld.exe

Language Features (Milestone 3+)

BasicForge is a case-insensitive, strongly typed language with Visual Basic-inspired syntax.

Variables and Types

Dim age As Integer = 25
Dim name As String = "Iliya"
Dim enabled As Boolean = True
Dim total = 100          ' Type inference

Conditions

If age >= 18 Then
    Print("Adult")
Else
    Print("Minor")
End If

Loops

For i As Integer = 1 To 10
    Print(i)
Next

While condition
    Print("Working")
End While

Select Case

Select Case value

    Case 1
        Print("One")

    Case 2
        Print("Two")

    Case Else
        Print("Other")

End Select

Procedures and Functions

Sub SayHello(name As String)

    Print("Hello " & name)

End Sub

Function Add(a As Integer, b As Integer) As Integer

    Return a + b

End Function

Modules

Module Main

    Sub Main()

        Dim result As Integer = Add(10, 20)

        Print(result)

    End Sub

End Module

Classes

Fields, auto-properties, constructors, methods and Me are supported end-to-end (including As New and method calls):

Module Main
    Class Person
        Public Name As String
        Public Age As Integer

        Public Sub New(name As String, age As Integer)
            Me.Name = name
            Me.Age = age
        End Sub

        Public Function GetInfo() As String
            Return Me.Name & " is " & CStr(Me.Age)
        End Function
    End Class

    Sub Main()
        Dim p As New Person("Alice", 30)
        Print(p.GetInfo())
    End Sub
End Module

Standard String Functions

Left, Right, Mid, InStr, Format, Len, Trim, Replace, Split, Join

String Interpolation

Dim name As String = "BasicForge"
Print($"Hello {name}!")   ' Hello BasicForge!

$"..." embeds expressions in {...}; {{/}} escape literal braces.

Type Conversion

CInt, CLng, CDbl, CStr, CBool

Control Flow

For Each, Do / Loop, Try / Catch / Finally (planned)


Repository Structure

BasicForge/
├── compiler/          # C++ compiler frontend, semantic analysis, IR, codegen
├── ide/               # Rust desktop IDE
├── runtime/           # Minimal native runtime (C/C++)
├── libraries/         # Standard library
├── examples/          # Example .bf programs
├── tests/             # Compiler and IDE tests
├── docs/              # Language specification and syntax docs
├── ARCHITECTURE_DECISIONS/  # Architecture decision records
├── THIRD_PARTY_NOTICES.md   # Third-party attribution
├── DEPENDENCIES.md          # Dependency registry
├── DEPENDENCY_LICENSES.md   # License compatibility
├── LANGUAGE_SPECIFICATION.md# Formal language specification
└── README.md              # This file

Third-Party Components

BasicForge reuses mature open-source infrastructure:

  • clang/LLVM — C emission, optimization and toolchain (Apache 2.0 + LLVM Exception)
  • LLD — Windows PE/COFF linker (Apache 2.0 + LLVM Exception)
  • egui — Rust GUI framework (MIT OR Apache-2.0)
  • tower-lsp — Language Server Protocol (MIT OR Apache-2.0)
  • tree-sitter / rowan / salsa — Incremental parsing and syntax trees (MIT OR Apache-2.0)
  • gimli / goblin / LIEF — Binary parsing and debug info (MIT OR Apache-2.0)
  • Ninja — Build system (Apache 2.0)

See THIRD_PARTY_NOTICES.md and DEPENDENCY_LICENSES.md for full attribution.


License

See LICENSE for details.

Third-party components retain their original licenses and attribution notices.


Roadmap

Milestone Status Description
M0 ✅ Research and architecture
M1 ✅ Build infrastructure
M2 ✅ First working compiler (HelloWorld → PE32+ EXE)
M3 ✅ Core language (variables, types, arithmetic, conditions, loops, sub/functions, modules)
M4 ✅ Classes, properties, constructors, methods, arrays, enums, type conversion, string functions, Do/Loop (verified end-to-end)
M5 🔄 Runtime (memory, file I/O, exception handling)
M6 ✅ Rust IDE (editor, project explorer, build/run, diagnostics, form designer UI)
M7 ✅ bfc --lsp server: diagnostics, completion, hover, definition
M8 ✅ Visual Form Designer → native Win32 forms (Button/Label/TextBox/...)
M9 ✅ Native debugger CLI (bfc debug): breakpoints, step, backtrace, print
M10 ⏳ Optimization and stability
M11 ⏳ Documentation and release

Known Limitations

  • Windows x64 only. The compiler, runtime, forms and debugger target x86_64-pc-windows-msvc. This is intentional and not planned to change.
  • Form Designer scope. Forms compile to Win32 windows with the 10 supported controls and Click/TextChanged events. The IDE designer can create/open/save forms and emits compilable Form code.
  • Debugger scope. bfc debug supports conditional INT3 breakpoints (break <name> if <cond>), locals/stack, watch/unwatch, setreg, disasm, threads, delete, enable/disable and --script. The IDE panel drives it and shows disassembly and editable registers; source-level locals from PDB local info are not implemented yet.
  • LSP scope. Hover/definition use the current file plus a workspace-wide symbol index with function signatures, parameter types and class members. Diagnostics run the semantic analyzer with workspace symbols registered, so cross-file type mismatches are reported.
  • No cross-compilation and no bundled LLVM; LLVM/clang/lld-link are detected from BFC_LLVM_ROOT / BFC_LLVM_BIN / PATH.

Contributing

See CONTRIBUTING.md for guidelines on contributing to BasicForge.


Contact

For questions, issues, or contributions, please open an issue on the project repository.

About

BasicForge is an independent, native programming language that combines the readability of Visual Basic with the performance of compiled languages. It comes with its own: Compiler, Visual IDE & Runtime Library and Native Output.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages