PAL语言

PAL,是教育算法语言(Pedagogic Algorithmic Language)的首字母简写,它是在大约1967年于麻省理工学院开发的编程语言,用于帮助教授编程语言语义和设计。它是ISWIM的直接后代,并拥有很多来自Christopher Strachey的哲学。

PAL最初用Lisp实现,由彼得·蘭丁和小詹姆斯·H·莫里斯(James H. Morris, Jr.)书写。后来馬丁·理察德、Thomas J. Barkalow、Arthur Evans, Jr.、Robert M. Graham、James Morris, Jr和对它做了重新设计。Richards和Barkalow将它用BCPL实现为中间代码解释器,并运行在IBM System/360之上,它被称为PAL/360。

样例
// Sample PAL program.
let Abs x = // compute absolute value of argument
x -x ! x
in
let Sqrt x = // compute square root of x
f(x/2.0) // initial approximation is x/2
where rec f t = // a recursive function for Newton's method
Abs(t*t - x) t // Yes, so return t as result.
! f(0.5*(t + x/t)) // No, so keep trying...
in
let i = 0 // a counter, to have its square root taken.
in
L:​ // the main loop of this rather simple little program..
Write (i, 't', Sqrt(ItoR i), 'n');
i​ := i + 1;
i // not yet, so keep going
go​to L
! // All done, so say so and go home.
Write 'nAll done.n'

RPAL
RPAL,即“右引用PAL”,是PAL的函数式子集的实现。它被用在佛罗里达大学用于教学编程语言构造和函数式编程。程序是严格的函数式的,没有赋值运算序列。

引用

评论 (0)

  • 还没有评论,来抢沙发吧。