L

Logo

L Programming Language

View the Project on GitHub juliojimenez/L

L

Tests Build GitHub Release

Quality Gate Status Lines of Code Reliability Rating Security Rating Maintainability Rating Vulnerabilities

The L programing language is a simple Lisp-like language. It is a work in progress.

Features

L aims to closely follow the Revised^7 Report on the Algorithmic Language Scheme (R7RS).

Installation

macOS

wget https://github.com/juliojimenez/L/releases/download/0.0.18/llang-0.0.18-darwin-arm64
mv llang-0.0.18-darwin-arm64 llang

Linux

wget https://github.com/juliojimenez/L/releases/download/0.0.18/llang-0.0.18-linux-amd64
mv llang-0.0.18-linux-amd64 llang

REPL

./llang
L v0.0.18

>

Syntax

Arithmetic

Addition

> (+ 1 (+ 2 3))
6

Subtraction

> (- 3 -3)
6

Multiplication

> (* 3 3)
9

Division

> (/ 12 6)
2

Modulus

> (% 12 7)
5

Predicates

Equal

> (= 1 2)
#f
> (= 1 1)
#t
> (= (+ 1 1) 2)
#t

Branching

if

> (if #t (+ 1 2) (+ 2 3))
3
> (if #f (+ 1 2) (+ 2 3))
5
> (if (= 1 2) (+ 1 2) (+ 2 3))
5

Variables

define

> (define a 10)
()
> (define b a)
()
> a
10
> b
10
> (define x (+ 1 2))
done
> x
3

set!

> (define x 10)
()
> x
10
> (set! x 20)
()
> x
20

get

> (define x 10)
()
> (get x)
10

Lists

cons

> (cons 1 2)
(1 . 2)

car

> (car (cons 1 2))
1

cdr

> (cdr (cons 1 2))
2

quote

> (quote (cons 12 10))
(cons 12 10)
> (quote (cons #t 3))
(cons #t 3)

The apostrophe or single-quote ' is a shorthand for quote.

> '(cons 12 10)
(cons 12 10)

list

> (list 1 2 3)
(1 2 3)

Procedures

lambda

> (lambda () (+ 1 2))
<#lambda>
> ((lambda () (+ 1 2)))
3
> ((lambda (a b) (+ a b)) 2 2)
4

The L mascot is a lemming named Lemmy.