Skip to content

technohippy/Kaleidoscope.ja

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

日本語プログラミング言語「カレイドスコープ」

概要

LLVMで日本語プログラミング言語作れるのかなと思って試しにKaleidoscopeの予約語や識別子を日本語にしてみました。

ファイル説明

  • README.md : 本ファイル
  • bin/kaleidoscope : コマンド
  • src/kaleidoscope_ja.rb : 日本語プログラミング言語
  • src/compat_ja.rb : C言語の関数を模擬
  • src/print.cpp : 組み込み関数定義
  • sample/mandel.ksj : マンデルブロ表示プログラム(サンプル)

使い方

組み込み関数の準備

$ clang++ -emit-llvm -S src/print.cpp -o print.ll
$ llvm-as print.ll

REPL開始

$ bin/kaleidoscope

サンプルの実行

$ bin/kaleidoscope sample/mandel.ksj

サンプルの実行結果

*******************************************************************************
*******************************************************************************
****************************************++++++*********************************
************************************+++++...++++++*****************************
*********************************++++++++.. ...+++++***************************
*******************************++++++++++..   ..+++++**************************
******************************++++++++++.     ..++++++*************************
****************************+++++++++....      ..++++++************************
**************************++++++++.......      .....++++***********************
*************************++++++++.   .            ... .++**********************
***********************++++++++...                     ++**********************
*********************+++++++++....                    .+++*********************
******************+++..+++++....                      ..+++********************
**************++++++. ..........                        +++********************
***********++++++++..        ..                         .++********************
*********++++++++++...                                 .++++*******************
********++++++++++..                                   .++++*******************
*******++++++.....                                    ..++++*******************
*******+........                                     ...++++*******************
*******+... ....                                     ...++++*******************
*******+++++......                                    ..++++*******************
*******++++++++++...                                   .++++*******************
*********++++++++++...                                  ++++*******************
**********+++++++++..        ..                        ..++********************
*************++++++.. ..........                        +++********************
******************+++...+++.....                      ..+++********************
*********************+++++++++....                    ..++*********************
***********************++++++++...                     +++*********************
*************************+++++++..   .            ... .++**********************
**************************++++++++.......      ......+++***********************
****************************+++++++++....      ..++++++************************
*****************************++++++++++..     ..++++++*************************
*******************************++++++++++..  ...+++++**************************
*********************************++++++++.. ...+++++***************************
***********************************++++++....+++++*****************************
***************************************++++++++********************************
*******************************************************************************
*******************************************************************************
*******************************************************************************
*******************************************************************************
*******************************************************************************

参考

About

日本語プログラミング言語 on LLVM

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published