Giter Club home page Giter Club logo

maru's Introduction

(On Linux, type "make".  On Darwin, edit the first line of emit.l to
set __MACH__ to anything other than () then type "make".  MinGW has
library issues and doesn't work -- sorry.)

This is a metacircular evaluator for an s-expression language, plus a
"level shift" from s-expressions down to IA32 machine code to escape
the infinite metacircular regress.

boot-eval.c contains a reader/evaluator for the s-expression language,
written in C.  eval.l contains the same evaluator, written in the
s-expression language.  emit.l contains a compiler from s-expressions
to IA32 machine code, written in the s-expression language.  boot.l
contains some data structures and algorithms needed by emit.l, written
in the s-expression language.

boot-eval.c is compiled and then run on boot.l+emit.l+eval.l to create
eval.s, a machine code implementation of the s-expression evaluator.
eval.s is then assembled and linked to make eval, which can be run on
boot.l+emit.l+eval.l to create eval.s.  The C compiler is then
entirely out of the loop (unless you lose a working evaluator and need
to bootstrap again).

The s-expression language has a few interesting characteristics.  You
can get a feeling for some of them by looking how messaging and
multimethods are implemented.  The compiler makes some attempt to be
small and simple (1750 loc for all three ".l" files, including some
debugging cruft that could be removed) and no attempt whatsoever to
optimise. Even so, the generated code runs at 40% the speed of
aggressively-optimised C on my E5430, measured by the convenient macro
benchmark: dividing the run time of regenerating eval.s via eval by
that of generating it initially via boot-eval.

maru's People

Contributors

jmckitrick avatar

Stargazers

Jake Johnson avatar  avatar Raimon Grau avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.