Updated as follows:
1. Support for Super macros
2. Fix bugs
:
Https://github.com/roundsheep/rpp
Super macros can define the grammar arbitrarily, restricting your imagination only:
void Main () {==> 2 3 <==┏━━━━━┓┃1 2 ┃┃3 4 ┃ ┗━━━━━┛}mac$ ==> _word _word <=={PUTSL (rstr ($) +rstr ($))}mac$┏━━━━━┓┃_word _word┃┃_word _WORD┃┗━━━━━┛{PUTSL (RSTR ($) + '--' +rstr ($) + '--' +rstr ($) + '--' +rstr ($))}
The following is a BF interpreter implemented with RPP:
/*BF interpreter, below is a bf version of Hello world:++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++ ++++.. +++.>++.<<+++++++++++++++.>.+++.------.--------. >+.>.*/void Main () {code=getslrbuf<int> Data (30000) Rf.memset (data.begin,0,data.size) pd=0for pc=0;pc<code.count;pc++switch code[pc]case ' >pd++case ' <pd--case ' +data[pd]++case '-data[pd]--case '. puts (Rstr.format ('%c ', DATA[PD]) case ', data[pd]=rf.getchcase ' [if data[pd]==0pc=find< + + > (Pc,code, ' [, ']) continue//here also available Continuedcase ']if data[pd]!=0pc=find<--> (PC, Code, '], ' [) continue}int find<t> (int pc,rstr& code,int left,int right) {count=0for i=pc;; I Tif code[i]==leftcount++elif code[i]==rightcount--if Count==0return i}
Welcome to the national Day, domestic open source programming language RPP 1.87 released!