欢天喜地迎国庆,国产开源编程语言 RPP 1.87 公布!
2024-08-30 03:50:29
更新例如以下:
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
}
最新文章
- 支持自动切换的tab标签代码札记
- 使用eclipse创建spring mvc web工程并部署
- SQL Server 查询时间段内数据
- spring 好处与优点
- Unity3D 经验记录
- asp.net MVC4 +MVCpager 无刷新分页
- 你喜欢SOAP吗?反正我不喜欢!
- 打印ASCII码
- bzoj 4539: [Hnoi2016]树
- 安装酷痞到IIS7.x共用80端口Windows(64位)系统下运行多个酷痞
- 第 9 章 数据管理 - 074 - 如何安装和配置 Rex-Ray?
- [STM32F103]串口UART配置
- 剑指offer(18)二叉搜索树的后续遍历
- SpringBoot构建大数据开发框架
- rocketmq ---->; 学习笔记
- HDU 2865 Birthday Toy
- 标 题: JavaScript真的要一统江湖了
- BCB 串口控件的使用 TComm
- String和int互相转换,String转float
- RabbitMQ 安装和监控[原,转]