Safety and Liveness Properties

During the execution, we will concern certain program properties, such as program correctness, program halt, no exceptions, etc. For those program properties one may interest in, it can be divided into two categories:

  • Safety Properties, It will not step into unexpected state during program execution (such as call with unmatched parameters, array subscript out of bounds, etc.):
  • Liveness Properties, The expected state will arrive during program execution eventually(such as halt, get resource request must return successfully, etc.).

The topology of program properties will be introduced below. Finally, for any program property, it can be decomposed into the intersection of its safety component and liveness component.

Continue reading

Parser combinator 在C++里的DSL

如果对编译原理稍微有了解, 相信你一定知道语法, 语法分析(Parsing)和语法分析算法, 也见过语法分析器(Parser). 当需要对某个语言进行处理时语法分析是必不可少的阶段, 可是呢, 实现语法却很繁琐, 就算是递归下降算法LL家族在语法较复杂的时候实现也会变得很繁琐单调, 更别说对编码不友好的LR家族算法了. 很多小伙伴会选择使用语法器生成器(Parser generator)来编译产生语法分析器, 输入文法和相关的操作输出一个语法分析器的源码. 这是其中一种很不错的办法, 相信大家都知道, 这里呢介绍另一种比较少被了解的办法: 语法分析器组合子(Parser combinator).

Continue reading

Mathematics a special art form

As we known, art is a diverse range of human activities and the products of those activities, usually involving imaginative or technical skill. Public can easily access to diverse types of art like visual arts including the creation of images or presenting object visually, literature and performing arts represented by music, theater, film and dance.However few people get the idea that there is a special art form,mathematics as well as science. Continue reading