mirror of
https://github.com/blackboxprogramming/BlackRoad-Operating-System.git
synced 2026-03-17 06:57:17 -05:00
This commit introduces the foundational specification for Lucidia v1.0 - a set of 100 working example programs that DEFINE the language through demonstration rather than formal grammar. Key Philosophy: - Examples ARE the spec (not documentation OF the spec) - AI systems learn by reading all 100 examples and extracting patterns - Humans learn by working through examples sequentially - No feature exists unless demonstrated in these examples Structure: - 001-010: Fundamentals (hello world → functions) - 011-020: Data & Collections (lists, maps, sets) - 021-030: Control Flow (if, loops, pattern matching) - 031-040: Functions & Composition (map, filter, reduce, closures) - 041-050: UI Basics (forms, inputs, validation) - 051-060: Reactive Programming (state, watchers, events) - 061-070: Consent & Privacy (permission system - CORE DIFFERENTIATOR) - 071-080: Storage & Sync (local-first, cloud-optional) - 081-090: AI Integration (intent → code, learning user style) - 091-100: Complete Applications (todo, notes, chat, e-commerce) Core Language Features Demonstrated: ✓ Intent over ceremony (write WHAT, not HOW) ✓ Consent as syntax (ask permission for: resource) ✓ Local-first storage (store locally, sync to cloud optional) ✓ AI-collaborative (### Intent comments become code) ✓ Reactive by default (state, watch, computed) ✓ Zero setup (runs in browser via WASM) ✓ Multi-paradigm (functional, OOP, reactive, agent-based) ✓ Gradual complexity (hello world → production apps) Files Created: - README.md - Learning philosophy and path - INDEX.md - Complete reference table - 001-100.lucidia - All example programs Total: 102 files, ~3,500+ lines of example code Why This Matters: This is not just documentation. This IS Lucidia. Every parser, compiler, AI assistant, and developer tool will be trained on these examples. They are the permanent, immutable foundation of the language. Next Steps: 1. Build parser that learns from these examples 2. Train AI to recognize and generate Lucidia patterns 3. Create browser playground with these as gallery 4. Use for academic paper and conference presentations Designed by: Cece (Principal Language & Runtime Architect) For: BlackRoad Operating System / Lucidia Programming Language Status: Complete foundation for implementation
113 lines
2.8 KiB
Plaintext
113 lines
2.8 KiB
Plaintext
# 094: Expense Tracker
|
|
# Track spending with categories and insights
|
|
|
|
state expenses = load "expenses" locally or []
|
|
state budget = load "budget" locally or { monthly: 2000 }
|
|
|
|
# Add expense
|
|
form add_expense:
|
|
input amount -> new_expense.amount
|
|
type: "number"
|
|
placeholder: "0.00"
|
|
|
|
input description -> new_expense.description
|
|
placeholder: "What was this for?"
|
|
|
|
select category -> new_expense.category
|
|
options: ["Food", "Transport", "Entertainment", "Bills", "Shopping", "Other"]
|
|
|
|
date_picker date -> new_expense.date
|
|
default: today()
|
|
|
|
button "Add Expense" -> save_expense(new_expense)
|
|
|
|
save_expense(exp):
|
|
exp.id = generate_id()
|
|
exp.created_at = now()
|
|
|
|
expenses.append(exp)
|
|
store expenses locally as "expenses"
|
|
|
|
new_expense = {}
|
|
show "Expense added"
|
|
|
|
# Delete expense
|
|
delete_expense(id):
|
|
expenses = expenses.filter(e => e.id != id)
|
|
store expenses locally as "expenses"
|
|
|
|
# Analytics
|
|
computed this_month_expenses = expenses.filter(e => {
|
|
is_this_month(e.date)
|
|
})
|
|
|
|
computed total_this_month = this_month_expenses
|
|
.reduce((sum, e) => sum + e.amount, 0)
|
|
|
|
computed by_category = this_month_expenses
|
|
.group_by(e => e.category)
|
|
.map(group => ({
|
|
category: group.key,
|
|
total: group.items.reduce((sum, e) => sum + e.amount, 0),
|
|
count: group.items.length
|
|
}))
|
|
.sort_by(g => g.total)
|
|
.reverse()
|
|
|
|
computed budget_remaining = budget.monthly - total_this_month
|
|
|
|
computed is_over_budget = total_this_month > budget.monthly
|
|
|
|
# Display summary
|
|
show_card:
|
|
title: "This Month"
|
|
value: "${total_this_month.toFixed(2)}"
|
|
subtitle: "of ${budget.monthly} budget"
|
|
|
|
if is_over_budget:
|
|
show_warning "Over budget by ${(total_this_month - budget.monthly).toFixed(2)}"
|
|
else:
|
|
show_success "${budget_remaining.toFixed(2)} remaining"
|
|
|
|
# Category breakdown
|
|
show "Spending by Category"
|
|
for cat in by_category:
|
|
show_category_bar:
|
|
name: cat.category
|
|
amount: cat.total
|
|
percent: (cat.total / total_this_month * 100).toFixed(1)
|
|
|
|
# Recent expenses
|
|
show "Recent Expenses"
|
|
for exp in expenses.sort_by(e => e.created_at).reverse().take(10):
|
|
show_expense_row:
|
|
description: exp.description
|
|
category: exp.category
|
|
amount: "${exp.amount.toFixed(2)}"
|
|
date: format_date(exp.date)
|
|
on_delete: () => delete_expense(exp.id)
|
|
|
|
# AI Insights
|
|
button "Get Spending Insights" -> show_insights()
|
|
|
|
show_insights():
|
|
### Intent: Analyze spending patterns and provide insights
|
|
insights = ai.analyze(expenses, {
|
|
focus: "patterns, unusual spending, savings opportunities"
|
|
})
|
|
|
|
show insights
|
|
|
|
# Export
|
|
button "Export to CSV" -> export_data()
|
|
|
|
export_data():
|
|
csv = ai.transform(expenses, { to: "csv" })
|
|
save_file("expenses.csv", csv)
|
|
|
|
generate_id():
|
|
return now() + Math.random()
|
|
|
|
is_this_month(date):
|
|
return date.month == today().month and date.year == today().year
|