Skip to content

claeusdev/l-lang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

L Language

L is a very simple untyped functional programming language based on lambda calculus for evaluating simple math expressions.

This project puts a web interface to the interpreter.

Screenshot 2025-05-28 at 15 22 22

πŸš€ Project Setup & Run Guide

This project contains:

  • βœ… A Haskell Scotty server (l-lang)
  • βœ… A Vite + React client (web-client)
  • βœ… Docker + Docker Compose configuration to run both together
  • βœ… Standalone mode for deploying without the Haskell server

πŸ“¦ Project Structure

./            β†’ Haskell Scotty app (with Dockerfile)
/web-client        β†’ Vite + React app (with Dockerfile)
docker-compose.yml β†’ top-level orchestration

πŸ”§ Prerequisites

For standalone mode:


πŸ— How to Build & Run

Option 1: Full Stack with Docker (Recommended for Development)

1️⃣ Clone the repository:

git clone https://github.com/claeusdev/l-lang
cd l-lang

2️⃣ Build and start everything:

docker compose up --build

βœ… This will:

Option 2: Standalone React App (No Haskell Server Required)

πŸš€ Perfect for production deployments or when you just want to try the L language!

1️⃣ Navigate to the web client:

cd web-client

2️⃣ Install dependencies:

npm install

3️⃣ Build the standalone version:

# Using the build script (recommended)
./build-standalone.sh

# Or manually
npm run build:standalone

4️⃣ Serve the standalone app:

# Using the built-in server
npm run serve:standalone

# Or using the executable script directly
./standalone-server.js

# Or serve with any static file server
npx serve dist

βœ… Standalone Features:

  • πŸ”„ Offline L language interpreter - No backend required!
  • πŸ“ Sample code snippets with valid L language syntax
  • πŸ’Ύ Local storage for saving your code snippets
  • 🎨 Full UI functionality including Monaco editor
  • πŸ“± Responsive design works on mobile and desktop

Access the standalone app: http://localhost:8080


🌐 Access the Apps

Service Local URL Description
Full Stack Client http://localhost:5173 React app with Haskell backend
Haskell Server http://localhost:3000 API server (development)
Standalone App http://localhost:8080 Self-contained React app

πŸ“š L Language Examples

The standalone app comes with built-in sample snippets demonstrating L language syntax:

Basic Arithmetic

x = 10
y = 20
x + y
x * y

Lambda Functions

double = \x -> x * 2
triple = \x -> x * 3
square = \x -> x * x

double 5
triple 4
square 6

Function Composition

double = \x -> x * 2
triple = \x -> x * 3
compose = \f -> \g -> \x -> f (g x)

doubleTriple = compose double triple
doubleTriple 5

Let Expressions

double = \x -> x * 2
let x = 10 in double x
let y = 5 in let z = y + 3 in z * 2

Complex Example from test.l

double = \x -> x * 2
triple = \x -> x * x * x
compose = \f -> \g -> \x -> f (g x)

composedDoubleTriple = compose double
trippledDoubledComposed = composedDoubleTriple triple

trippledDoubledComposed 5

let x = 100 in trippledDoubledComposed (double 10)

πŸ”„ Common Commands

Full Stack Development

  • Stop the services:

    docker-compose down
  • Rebuild only:

    docker-compose build
  • View logs:

    docker-compose logs -f
  • Restart with rebuild:

    docker-compose up --build

Standalone Development

  • Development mode:

    cd web-client
    npm run dev
  • Build for production:

    cd web-client
    npm run build:standalone
  • Serve built app:

    cd web-client
    npm run serve:standalone

🚒 Deployment Options

Traditional Static Hosting

The standalone build creates a dist folder that can be deployed to any static hosting service:

  • Netlify
  • Vercel
  • GitHub Pages
  • AWS S3 + CloudFront
  • Any web server (Apache, Nginx)

Self-Hosted

Use the included standalone-server.js script on any Node.js server:

# On your server
cd web-client
npm install --production
npm run build:standalone
node standalone-server.js

Docker Standalone

Build a lightweight Docker image for the standalone app:

FROM node:18-alpine
WORKDIR /app
COPY web-client/package*.json ./
RUN npm install --production
COPY web-client/dist ./dist
COPY web-client/standalone-server.js ./
EXPOSE 8080
CMD ["node", "standalone-server.js"]

About

A very minimal functional programming language implementation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •