Skip to content

bennyyip/kaleidoscope-oxidized

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kaleidoscope: Implementing a Language with LLVM

A Kaleidoscope implementation in rust. Currently 8 out of 10 chapters are done.

Example

23:55:28 benyip @ alcohol ω ~/.ghq/github.com/bennyyip/kaleidoscope (master)
λ cargo run --  --help
   Compiling kaleidoscope v0.1.0 (file:///home/benyip/.ghq/github.com/bennyyip/kaleidoscope)
    Finished dev [unoptimized + debuginfo] target(s) in 3.43 secs
     Running `target/debug/kaleidoscope --help`
kaleidoscope 0.1.0
BennyYip <[email protected]>
kaleidoscope REPL

USAGE:
    kaleidoscope [FLAGS] [OPTIONS]

FLAGS:
        --dc         Prints LLVM IR
        --dl         Prints lexer output
        --dp         Prints parser output
    -h, --help       Prints help information
    -0               Diable LLVM function pass managers
    -V, --version    Prints version information

OPTIONS:
    -i, --input <input>    input file
23:55:33 benyip @ alcohol ω ~/.ghq/github.com/bennyyip/kaleidoscope (master)
λ cargo run --  --dc -i example/mandelbrot.ks
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
     Running `target/debug/kaleidoscope --dc -i example/mandelbrot.ks`
?> mandel(-2.3, -1.3, 0.05, 0.07);
-> IR:

define double @__MAIN__() {
entry:
  %unaryop = call double @unary-(double 2.300000e+00)
  %unaryop1 = call double @unary-(double 1.300000e+00)
  %calltmp = call double @mandel(double %unaryop, double %unaryop1, double 5.000000e-02, double 7.000000e-02)
  ret double %calltmp
}
*******************************************************************************
*******************************************************************************
****************************************++++++*********************************
************************************+++++...++++++*****************************
*********************************++++++++.. ...+++++***************************
*******************************++++++++++..   ..+++++**************************
******************************++++++++++.     ..++++++*************************
****************************+++++++++....      ..++++++************************
**************************++++++++.......      .....++++***********************
*************************++++++++.   .            ... .++**********************
***********************++++++++...                     ++**********************
*********************+++++++++....                    .+++*********************
******************+++..+++++....                      ..+++********************
**************++++++. ..........                        +++********************
***********++++++++..        ..                         .++********************
*********++++++++++...                                 .++++*******************
********++++++++++..                                   .++++*******************
*******++++++.....                                    ..++++*******************
*******+........                                     ...++++*******************
*******+... ....                                     ...++++*******************
*******+++++......                                    ..++++*******************
*******++++++++++...                                   .++++*******************
*********++++++++++...                                  ++++*******************
**********+++++++++..        ..                        ..++********************
*************++++++.. ..........                        +++********************
******************+++...+++.....                      ..+++********************
*********************+++++++++....                    ..++*********************
***********************++++++++...                     +++*********************
*************************+++++++..   .            ... .++**********************
**************************++++++++.......      ......+++***********************
****************************+++++++++....      ..++++++************************
*****************************++++++++++..     ..++++++*************************
*******************************++++++++++..  ...+++++**************************
*********************************++++++++.. ...+++++***************************
***********************************++++++....+++++*****************************
***************************************++++++++********************************
*******************************************************************************
*******************************************************************************
*******************************************************************************
*******************************************************************************
*******************************************************************************
=> 0
?>

LICENSE

MIT

Releases

No releases published

Packages

No packages published

Languages