Git Product home page Git Product logo

compiler-tutorial's Introduction

To run the tests, make sure that your compiler file is called
"compiler.scm", and that at the top of that file, you have:
(load "tests-driver.scm") ; this should come first
(load "tests-1.1-req.scm") ; and any other test files you may have.

Also, make sure that your compiler defines the function
compile-program that takes an expression and uses "emit" to emit the
appropriate instructions.

The tests-driver defines the procedure "test-all" that will run all
the tests provided, get the output, redirect it to a file "stst.s",
and invokes gcc on that file as well as the runtime.c file that you
should have written.

The tests-driver is written for [Petite] Chez Scheme 7.  You can
obtain a copy of Petite Chez Scheme from:
  http://www.scheme.com

The tests-driver also assumes that you have the GNU C compiler "gcc"
already setup and added to your pathname.  How you do this depends
on your platform.  If you have a different C compiler that you wish
to use, you can edit the tests-driver yourself (look for the
definition of the build procedure).

If all is well, then invoking petite on your compiler and typing
(test-all) should run all the tests as in the following sample 
transcript.

$ petite compiler.scm 
Petite Chez Scheme Version 7.0a
Copyright (c) 1985-2005 Cadence Research Systems

> (test-all)
  test 0:#f ... ok
  test 1:#t ... ok
  test 2:() ... ok
  test 3:0 ... ok
  test 4:1 ... ok
  test 5:-1 ... ok
  test 6:2736 ... ok
  test 7:-2736 ... ok
  test 8:536870911 ... ok
  test 9:-536870912 ... ok
  test 10:#\nul ... ok
  ...
  test 131:#\y ... ok
  test 132:#\z ... ok
  test 133:#\{ ... ok
  test 134:#\| ... ok
  test 135:#\} ... ok
  test 136:#\~ ... ok
  test 137:#\rubout ... ok
  passed all 138 tests
>


Enjoy.

Abdulaziz Ghuloum <[email protected]>

compiler-tutorial's People

Contributors

carld avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.