From 19f03b6d1aeebacdcaeeff01f645e65fea831fea Mon Sep 17 00:00:00 2001 From: Chad Smith Date: Tue, 17 Feb 2026 16:56:33 -0800 Subject: [PATCH 1/4] fix install script color escapes and show chad init in getting started --- install.sh | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/install.sh b/install.sh index c8221591..a687efac 100755 --- a/install.sh +++ b/install.sh @@ -6,21 +6,22 @@ INSTALL_DIR="$HOME/.chadscript" VERSION="0.1.0" if [ -t 1 ]; then - BOLD='\033[1m' - DIM='\033[2m' - GREEN='\033[32m' - CYAN='\033[36m' - YELLOW='\033[33m' - RED='\033[31m' - RESET='\033[0m' + ESC=$(printf '\033') + BOLD="${ESC}[1m" + DIM="${ESC}[2m" + GREEN="${ESC}[32m" + CYAN="${ESC}[36m" + YELLOW="${ESC}[33m" + RED="${ESC}[31m" + RESET="${ESC}[0m" else BOLD='' DIM='' GREEN='' CYAN='' YELLOW='' RED='' RESET='' fi -info() { printf "${CYAN}info${RESET} %s\n" "$1"; } -success() { printf "${GREEN} ✓${RESET} %s\n" "$1"; } -warn() { printf "${YELLOW}warn${RESET} %s\n" "$1"; } -err() { printf "${RED}error${RESET} %s\n" "$1" >&2; exit 1; } +info() { printf "%s\n" "${CYAN}info${RESET} $1"; } +success() { printf "%s\n" "${GREEN} ✓${RESET} $1"; } +warn() { printf "%s\n" "${YELLOW}warn${RESET} $1"; } +err() { printf "%s\n" "${RED}error${RESET} $1" >&2; exit 1; } detect_libc() { if [ "$(uname -s)" != "Linux" ]; then @@ -135,7 +136,9 @@ WRAPPER printf "\n" printf " Then try:\n" printf "\n" - printf " ${CYAN}chad run examples/hello.ts${RESET}\n" + printf " ${CYAN}mkdir myproject && cd myproject${RESET}\n" + printf " ${CYAN}chad init${RESET}\n" + printf " ${CYAN}chad run hello.ts${RESET}\n" printf "\n" } From 1b06b31562b66f9a01f36c8a7d3cb935a5e17c11 Mon Sep 17 00:00:00 2001 From: Chad Smith Date: Tue, 17 Feb 2026 17:16:15 -0800 Subject: [PATCH 2/4] use linker syslibroot instead of isysroot for macos sdk resolution --- src/compiler.ts | 2 +- src/native-compiler-lib.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler.ts b/src/compiler.ts index 51e37b89..967417b9 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -244,7 +244,7 @@ export function compile(inputFile: string, outputFile: string, logLevel: LogLeve if (generator.usesSqlite) { linkLibs = `-L${brewPrefix}/sqlite/lib ` + linkLibs; } if (generator.usesMongoose) { linkLibs = `-L${brewPrefix}/zstd/lib ` + linkLibs; } const sdkPath = execSync('xcrun --show-sdk-path', { stdio: 'pipe', encoding: 'utf8' }).trim(); - linkLibs = `-isysroot ${sdkPath} -L/usr/local/lib ` + linkLibs; + linkLibs = `-Wl,-syslibroot,${sdkPath} -L/usr/local/lib ` + linkLibs; } const lwsBridgeObj = generator.usesMongoose ? `${LWS_BRIDGE_PATH}/lws-bridge.o` : ''; const regexBridgeObj = generator.usesRegex ? `${LWS_BRIDGE_PATH}/regex-bridge.o` : ''; diff --git a/src/native-compiler-lib.ts b/src/native-compiler-lib.ts index 9e93c58f..f1717b04 100644 --- a/src/native-compiler-lib.ts +++ b/src/native-compiler-lib.ts @@ -188,7 +188,7 @@ export function compileNative(inputFile: string, outputFile: string): void { if (generator.getUsesCrypto()) { linkLibs = '-L/opt/homebrew/opt/openssl/lib -L/usr/local/opt/openssl/lib ' + linkLibs; } if (generator.getUsesSqlite()) { linkLibs = '-L/opt/homebrew/opt/sqlite/lib -L/usr/local/opt/sqlite/lib ' + linkLibs; } if (generator.getUsesMongoose()) { linkLibs = '-L/opt/homebrew/opt/zstd/lib -L/usr/local/opt/zstd/lib ' + linkLibs; } - linkLibs = '-isysroot $(xcrun --show-sdk-path) -L/usr/local/lib ' + linkLibs; + linkLibs = '-Wl,-syslibroot,$(xcrun --show-sdk-path) -L/usr/local/lib ' + linkLibs; } const linkCmd = clangTool + ' ' + objFile + ' ' + lwsBridgeObj + ' ' + regexBridgeObj + ' ' + treeSitterObjs + ' -o ' + outputFile + noPie + ' ' + linkLibs; if (verbose) { console.log('Running: ' + linkCmd); } From d06bfd38511b475618dbf2719bf1cae4a72c9986 Mon Sep 17 00:00:00 2001 From: Chad Smith Date: Tue, 17 Feb 2026 21:44:59 -0800 Subject: [PATCH 3/4] fix mobile benchmark overlap and add zero-cost c interop feature --- docs/.vitepress/theme/index.mts | 1 - docs/index.md | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/.vitepress/theme/index.mts b/docs/.vitepress/theme/index.mts index dc114ead..c631f39e 100644 --- a/docs/.vitepress/theme/index.mts +++ b/docs/.vitepress/theme/index.mts @@ -16,7 +16,6 @@ export default { Layout() { return h(DefaultTheme.Layout, null, { 'doc-before': () => h(CopyMarkdown), - 'home-hero-image': () => h(HeroBenchmarks), }) }, enhanceApp({ app }) { diff --git a/docs/index.md b/docs/index.md index eb1bd572..a26f70ff 100644 --- a/docs/index.md +++ b/docs/index.md @@ -19,10 +19,14 @@ features: details: Write the TypeScript you already know. Classes, interfaces, async/await, generics - it all works. - title: Batteries Included details: HTTP servers, file I/O, JSON, crypto, SQLite, regex, async - all compiled to native code. No npm required. + - title: Zero-Cost C Interop + details: C libraries like SQLite and OpenSSL are called directly through LLVM IR — no FFI boundary, no marshaling, no overhead. Same cost as a native function call. --- + + From f3842cb7c0716b21575132a916e38d5b2ad7598d Mon Sep 17 00:00:00 2001 From: Chad Smith Date: Tue, 17 Feb 2026 22:42:53 -0800 Subject: [PATCH 4/4] interactive pipeline showcase with hexagon, ir highlighting, and typewriter animations --- docs/.vitepress/config.mts | 8 + docs/.vitepress/llvm.tmLanguage.json | 18 + docs/.vitepress/theme/ExampleTabs.vue | 79 ++- docs/.vitepress/theme/HeroBenchmarks.vue | 1 + docs/.vitepress/theme/IRShowcase.vue | 774 ++++++++++++++++++----- docs/index.md | 15 +- 6 files changed, 722 insertions(+), 173 deletions(-) create mode 100644 docs/.vitepress/llvm.tmLanguage.json diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 2c04af3e..269c82ee 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -2,6 +2,10 @@ import { defineConfig } from 'vitepress' import fs from 'node:fs' import path from 'node:path' +const llvmGrammar = JSON.parse( + fs.readFileSync(path.resolve(__dirname, 'llvm.tmLanguage.json'), 'utf-8') +) + export default defineConfig({ title: 'ChadScript', description: 'Compile TypeScript to native binaries via LLVM', @@ -9,6 +13,10 @@ export default defineConfig({ base: '/ChadScript/', appearance: 'dark', + markdown: { + languages: [llvmGrammar], + }, + transformPageData(pageData) { const mdPath = path.resolve(__dirname, '..', pageData.relativePath) try { diff --git a/docs/.vitepress/llvm.tmLanguage.json b/docs/.vitepress/llvm.tmLanguage.json new file mode 100644 index 00000000..ce882a3a --- /dev/null +++ b/docs/.vitepress/llvm.tmLanguage.json @@ -0,0 +1,18 @@ +{ + "name": "llvm", + "scopeName": "source.llvm", + "patterns": [ + { "match": ";.*$", "name": "comment.line.llvm" }, + { "match": "\\b(define|declare|global|constant|private|internal|external|unnamed_addr|align|to|nuw|nsw|exact|inbounds|volatile|tail|musttail|notail)\\b", "name": "keyword.other.llvm" }, + { "match": "\\b(ret|br|switch|invoke|resume|unreachable|call|alloca|load|store|getelementptr|extractvalue|insertvalue|extractelement|insertelement|shufflevector|phi|select|icmp|fcmp|add|sub|mul|udiv|sdiv|urem|srem|fadd|fsub|fmul|fdiv|frem|shl|lshr|ashr|and|or|xor|trunc|zext|sext|fptrunc|fpext|fptoui|fptosi|uitofp|sitofp|ptrtoint|inttoptr|bitcast|addrspacecast)\\b", "name": "keyword.control.llvm" }, + { "match": "\\b(i1|i8|i16|i32|i64|i128|float|double|void|label|metadata|token|ptr)\\b", "name": "storage.type.llvm" }, + { "match": "\\b(eq|ne|ugt|uge|ult|ule|sgt|sge|slt|sle|oeq|ogt|oge|olt|ole|one|ord|ueq|une|uno|true|false|null|zeroinitializer|undef|poison)\\b", "name": "constant.language.llvm" }, + { "match": "@[a-zA-Z$._][a-zA-Z$._0-9]*", "name": "entity.name.function.llvm" }, + { "match": "%[a-zA-Z$._][a-zA-Z$._0-9]*", "name": "variable.other.llvm" }, + { "match": "%[0-9]+", "name": "variable.other.llvm" }, + { "match": "\\b-?[0-9]+\\.?[0-9]*([eE][+-]?[0-9]+)?\\b", "name": "constant.numeric.llvm" }, + { "match": "c\"[^\"]*\"", "name": "string.quoted.double.llvm" }, + { "match": "\"[^\"]*\"", "name": "string.quoted.double.llvm" }, + { "match": "^[a-zA-Z$._][a-zA-Z$._0-9]*:", "name": "entity.name.label.llvm" } + ] +} diff --git a/docs/.vitepress/theme/ExampleTabs.vue b/docs/.vitepress/theme/ExampleTabs.vue index 7943be9f..4a21c97a 100644 --- a/docs/.vitepress/theme/ExampleTabs.vue +++ b/docs/.vitepress/theme/ExampleTabs.vue @@ -1,8 +1,12 @@