Skip to content

Zark is a lisp dialect prototype to understand about how compilers work

License

Notifications You must be signed in to change notification settings

douglasselias/zark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is Zark?

Zark is a lisp dialect prototype to understand about how compilers work

Start the interpreter with npm start

Sample:

(define factorial (lambda (n)
  (do 
    (define acc n)
    (while (less-than n 2)
      (do 
        (set n (sub n 1))
        (set acc (mul acc n))))
    acc)))

(factorial 6)

Documentation

Zark supports numbers, strings and lists

; Define a value
(define name "Zark")

; Set a value
(set name "Lisp")

; Define a function
(define is-even? (lambda (a)
  (even? a)))

; Declare a block of code
(do ...)

; Builtin function 'car' to get first element of list
(define odd-numbers (list 1 3 5 7 9))
(car odd-numbers) ; 1

; Explore src/evaluator.ts, src/env.ts to discover all available functions

About

Zark is a lisp dialect prototype to understand about how compilers work

Resources

License

Stars

Watchers

Forks