更新例如以下:

1.支持超级宏

2.修复bug

下载地址:

https://github.com/roundsheep/rpp

超级宏能够随意定义语法,制约你的仅仅有想象力:

void main()
{
==> 2 3 <== ┏━━━━━┓
┃ 1 2 ┃
┃ 3 4 ┃
┗━━━━━┛
} mac$ ==> _word _word <==
{
putsl(rstr($0)+rstr($1))
} mac$ ┏━━━━━┓┃ _word _word ┃ ┃ _word _word ┃┗━━━━━┛
{
putsl(rstr($0)+'--'+rstr($1)+'--'+rstr($2)+'--'+rstr($3))
}

以下是用RPP实现的BF解释器:

/*
BF解释器,以下是一个BF版的Hello World:
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
*/ void main()
{
code=getsl
rbuf<int> data(30000)
rf.memset(data.begin,0,data.size)
pd=0
for 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.getch
case `[
if data[pd]==0
pc=find< ++ >(pc,code,`[,`])
continue//这里也可用continued
case `]
if data[pd]!=0
pc=find< -- >(pc,code,`],`[)
continue
} int find<T>(int pc,rstr& code,int left,int right)
{
count=0
for i=pc;;i T
if code[i]==left
count++
elif code[i]==right
count--
if count==0
return i
}

最新文章

  1. 支持自动切换的tab标签代码札记
  2. 使用eclipse创建spring mvc web工程并部署
  3. SQL Server 查询时间段内数据
  4. spring 好处与优点
  5. Unity3D 经验记录
  6. asp.net MVC4 +MVCpager 无刷新分页
  7. 你喜欢SOAP吗?反正我不喜欢!
  8. 打印ASCII码
  9. bzoj 4539: [Hnoi2016]树
  10. 安装酷痞到IIS7.x共用80端口Windows(64位)系统下运行多个酷痞
  11. 第 9 章 数据管理 - 074 - 如何安装和配置 Rex-Ray?
  12. [STM32F103]串口UART配置
  13. 剑指offer(18)二叉搜索树的后续遍历
  14. SpringBoot构建大数据开发框架
  15. rocketmq ----&gt; 学习笔记
  16. HDU 2865 Birthday Toy
  17. 标 题: JavaScript真的要一统江湖了
  18. BCB 串口控件的使用 TComm
  19. String和int互相转换,String转float
  20. RabbitMQ 安装和监控[原,转]

热门文章

  1. poj--1703--Find them, Catch them(并查集巧用)
  2. HBase框架基础(一)
  3. IIS 7.5 配置
  4. FLUME KAFKA SOURCE 和 SINK 使用同一个 TOPIC
  5. Android中的Junit测试
  6. Android——PullToRefresh自动刷新
  7. XML与Plist文件转换
  8. poj2823/hdu3415 - 数据结构 单调队列
  9. UVa 12661 Funny Car Racing【 dijkstra 】
  10. shell脚本不同运行方式的差异