Skip to content

rniczh/rcis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rcis

rcis is the scheme to x64 compiler, it based on Indiana university's compiler courses, using nanopass compiler framework and chezscheme

Syntax

;;  Program → Exp
;;
;; Exp     → var
;;         | constant
;;         | 'Datum
;;         | (quote Datum)
;;         | (define var Exp)
;;         | (define (var var*) Exp)
;;         | (if Exp Exp)
;;         | (if Exp Exp Exp)
;;         | (begin Exp* Exp)
;;         | (let ([uvar Exp]*) Exp)
;;         | (letrec ([uvar Exp]*) Exp)
;;         | (letrec* ([uvar Exp]*) Exp)
;;         | (lambda (uvar*) Exp)
;;         | (ccall string Exp*)
;;         | (prim Exp*)
;;         | (Exp Exp* )
;;
;; Datum   → immediate
;;         | (Datum . Datum)
;;         | #(Datum*)
;;         | #&Datum
;;
;; prim    → + - * / mod div logand logor sra ash
;;         | <= < = > >=
;;         | boolean? eq? fixnum? procedure? box? pair? null? vector? string?
;;         | cons car cdr set-car! set-cdr!
;;         | box unbox set-box!
;;         | make-vector vector-length vector-ref vector-set!
;;         | void display newline read

Install

Dependencies:

Linux, GNU Make, GCC(version>=5), ChezScheme

$ make

if failed on using the protable ChezScheme, you need to install the ChezScheme and type

$ make install

If success it will display:

* configure options.ss...ok
* booting file...ok
* produce executable...ok
Executable at boot/rcis

and rcis will be compiled into boot directory.

Usage

alias the rcis in your .bashrc or .zshrc ... etc

  • Compile with C: (in example directory) rule: -o <output> <scheme-file> <c-files>*
$ rcis -o prog change.ss change.c
$ ./prog
  • Get more information
$ rcis --help

Test

  • Check file can be compiled
$ make test-all
  • Compare the rcis result with chezscheme result
$ make test-driver

Acknowledgements

The main reference comes from yscheme

Releases

No releases published

Packages

No packages published

Languages