8000 GitHub - frankleonrose/ulisp: Minimal, mostly wrong assembly compiler for a lisp-like language written in Javascript
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Minimal, mostly wrong assembly compiler for a lisp-like language written in Javascript

Notifications You must be signed in to change notification settings

frankleonrose/ulisp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ulisp

A minimal, mostly wrong assembly compiler for a lisp-like language written in Javascript.

Example

The following program:

$ cat tests/two_function_calls.js
(+ 1 (+ 2 9))

Returns 12 as its exit code when compiled:

$ node ulisp.js tests/two_function_calls.js
$ ./build/a.out
$ echo $?
12

By generating this assembly:

  .global _main

  .text

plus:
  ADD RDI, RSI
  MOV RAX, RDI
  RET

_main:
  PUSH RDI
  PUSH RSI
  MOV RDI, 1
  PUSH RDI
  PUSH RSI
  MOV RDI, 2
  MOV RSI, 9
  CALL plus
  POP RSI
  POP RDI
  MOV RSI, RAX

  CALL plus
  POP RSI
  POP RDI

  MOV RDI, RAX
  MOV RAX, 0x2000001
  SYSCALL

About

Minimal, mostly wrong assembly compiler for a lisp-like language written in Javascript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.5%
  • Common Lisp 0.5%
0