Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ EasyScript v2.0

A modern, reactive programming language that compiles to pure HTML/JS - No build tools, no dependencies, just write and run!

EasyScript is designed for rapid web development with built-in reactivity, comprehensive standard library, and intuitive syntax.

✨ Key Features

🎯 Core Language

  • Reactive State Management - Signals with automatic reactivity
  • Computed Values - Derived state with dependency tracking
  • Effects - Side effects that auto-rerun on changes
  • Component System - Reusable UI components with props
  • Router - Built-in client-side routing
  • Control Flow - if/else, for, while, switch/case, try/catch
  • Async/Await - First-class async support

πŸ“š Massive Standard Library (100+ Functions)

String Utilities (30+ functions)

str.titleCase("hello world")  // "Hello World"
str.camelCase("hello-world")  // "helloWorld"
str.snakeCase("HelloWorld")   // "hello_world"
str.isEmail("test@example.com") // true
str.truncate(text, 50, "...")

Array Methods (30+ functions)

arr.groupBy(users, 'role')
arr.shuffle([1,2,3,4,5])
arr.average([1,2,3,4,5])  // 3
arr.median([1,2,3,4,5])   // 3
arr.unique([1,2,2,3])     // [1,2,3]

Math Extensions (30+ functions)

math.average([1,2,3,4,5])
math.median([1,5,3,4,2])
math.variance(numbers)
math.stdDev(numbers)
math.distance(x1, y1, x2, y2)
math.randomInt(1, 100)

Date/Time (15+ functions)

date.addDays(new Date(), 7)
date.format(date.now())
date.isToday(someDate)
date.dayOfWeek(new Date())
date.daysBetween(date1, date2)

Object Utilities (10+ functions)

obj.deepClone(object)
obj.deepMerge(obj1, obj2)
obj.pick(user, ['name', 'email'])
obj.omit(user, ['password'])

DOM Helpers (15+ functions)

dom.query('.selector')
dom.on(element, 'click', handler)
dom.fadeIn(element, 300)
dom.addClass(element, 'active')

Storage (localStorage, sessionStorage, cookies)

storage.local.set('key', value)
storage.local.get('key')
storage.cookie.set('token', 'abc', 7)

HTTP & Network (6 methods)

await http.get(url)
await http.post(url, data)
await http.put(url, data)
await http.uploadFile(url, file)

Timer Functions

timer.debounce(func, 300)
timer.throttle(func, 1000)
timer.defer(func)

Validation

validate.isEmail(email)
validate.isURL(url)
validate.required(value)
validate.minLength(str, 5)

🎨 Quick Start

Installation

git clone <repo>
cd EasyScript
npm install

Your First App

Create hello.es:

page HelloWorld {
    state name = "World"
    
    layout: column
    style { padding: 40px; }
    
    text "Hello, " + name + "!" {
        style { font-size: 2rem; font-weight: bold; }
    }
    
    input "Your name" {
        bind: name
    }
}

Compile and run:

node src/index.js hello.es
# Opens hello.html in your browser!

πŸ› οΈ CLI Commands

Basic Usage

node src/index.js <file.es>

Watch Mode (auto-recompile on changes)

node src/index.js app.es --watch
# or
node src/index.js app.es -w

Debug Mode (verbose output)

node src/index.js app.es --debug
# or
node src/index.js app.es -d

Help

node src/index.js --help

πŸ“– Language Guide

Reactive State

page Counter {
    state count = 0  // Reactive signal
    
    button "+" {
        onClick -> count = count + 1
    }
    
    text "Count: " + count  // Auto-updates!
}

Components with Props

component UserCard(name, email) {
    card {
        text name { style { font-weight: bold; } }
        text email { style { color: #666; } }
    }
}

page Users {
    UserCard("Alice", "alice@example.com")
    UserCard("Bob", "bob@example.com")
}

Array Iteration

page TodoList {
    state todos = ["Buy milk", "Learn EasyScript", "Build app"]
    
    for todo in todos {
        card {
            text todo
        }
    }
}

Async/Await & HTTP

page DataFetcher {
    state users = []
    
    button "Load Users" {
        onClick -> {
            async {
                users = await http.get("https://api.example.com/users")
            }
        }
    }
}

localStorage Persistence

page Notes {
    state notes = []
    
    onMount -> {
        state saved = storage.local.get("notes")
        if saved {
            notes = saved
        }
    }
    
    button "Save" {
        onClick -> storage.local.set("notes", notes)
    }
}

Routing

page Home {
    text "Welcome Home"
}

page About {
    text "About Us"
}

router Main {
    route "/" -> Home
    route "/about" -> About
}

πŸ“‚ Examples

Counter with Stats

node src/index.js examples/counter.es

Demonstrates: reactive state, computed values, stdlib functions

Todo App

node src/index.js examples/todo-app.es

Demonstrates: CRUD operations, localStorage, filtering, statistics

API Integration

node src/index.js examples/api-demo.es

Demonstrates: async/await, HTTP requests, loading states, error handling

🎯 What's New in v2.0

βœ… Enhanced Reactivity

  • ReactiveArray - Array mutations trigger reactivity
  • computed() - Computed signals with dependency tracking
  • effect() - Auto-running side effects
  • watch() - Watch signal changes

βœ… Massive Standard Library

  • 100+ built-in functions across 11 categories
  • String validation & transformation
  • Array analysis & manipulation
  • Math statistics & geometry
  • Date/time utilities
  • Object deep operations
  • DOM manipulation & animations
  • Storage (localStorage, sessionStorage, cookies)
  • HTTP REST API client
  • Timer functions (debounce, throttle)
  • Form validation helpers

βœ… Developer Experience

  • --watch mode for auto-recompilation
  • --debug mode for verbose output
  • Colored terminal output
  • Better error messages
  • Helpful --help documentation

βœ… Language Features

  • Template literals (backticks)
  • Multi-line strings
  • break/continue in loops
  • Enhanced switch/case
  • try/catch/finally
  • Full async/await support

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   .es file      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     Lexer       β”‚ Tokenization
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚    Parser       β”‚ AST Generation
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Compiler      β”‚ Code Generation
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  .html output   β”‚ Runtime + App Code
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🀝 Contributing

EasyScript is open for contributions! Key areas:

  • Additional standard library functions
  • IDE/editor plugins
  • More examples
  • Documentation improvements

πŸ“„ License

MIT License - feel free to use in your projects!


Built with ❀️ for rapid web development

About

A modern, reactive programming language that compiles to pure HTML/JS - No build tools, no dependencies, just write and run! EasyScript is designed for rapid web development with built-in reactivity, comprehensive standard library, and intuitive syntax.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages