高中数学: 设x>=o,y>=o,x^2=y^2/2=1,则x√1+y^2的int 最大值值为?

众所周知,无机质子导体是一类重要的功能材料。它们可用作燃料电池、氢传感器、常压合成氨等多种电化学装置的固体电解质,具有十分重要的应用价值和广阔的应用前景。最近,一类新型中温(100―600°C)无机固体质子导体—焦磷酸盐(MP$$sub$$2$$/sub$$O$$sub$$7$$/sub$$)引起了人们的极大兴趣。MP$$sub$$2$$/sub$$O$$sub$$7$$/sub$$基导电材料在中温下具有较高的质子电导率,且难溶于水、热稳定性也较高。但至今未见系列样品Sn$$sub$$1-x$$/sub$$Zn$$sub$$x$$/sub$$P$$sub$$2$$/sub$$O$$sub$$7$$/sub$$的相纯度和电化学性能的报道以及Ga$$sup$$3+$$/sup$$掺杂TiP$$sub$$2$$/sub$$O$$sub$$7$$/sub$$导电陶瓷材料的报道。基于以上情况,本论文主要对MP$$sub$$2$$/sub$$O$$sub$$7$$/sub$$(M=Sn、Ti)基导电材料的中温电性能进行了研究。主要研究工作及结果如下:(1)第一章—绪论。简要介绍了一些典型的固体电解质材料、无机质子导体,有关的缺陷化学及传导机制、应用等。概述了MP$$sub$$2$$/sub$$O$$sub$$7$$/sub$$(M=Sn、Ti)基中温电解质材料的研究背景,提出了本论文的研究内容及研究意义。(2)第二章—Sn$$sub$$1-x$$/sub$$Zn$$sub$$x$$/sub$$P$$sub$$2$$/sub$$O$$sub$$7$$/sub$$的制备及中温电性能研究。制备了Sn$$sub$$1-x$$/sub$$Zn$$sub$$x$$/sub$$P$$sub$$2$$/sub$$O$$sub$$7$$/sub$$(x=0,0.03,0.06,0.09,0.12)系列陶瓷样品, XRD测试结果表明:Sn$$sub$$1-x$$/sub$$Zn$$sub$$x$$/sub$$P$$sub$$2$$/sub$$O$$sub$$7$$/sub$$的掺杂限度为9mol%。掺杂离子浓度x对样品电导率有着显著的影响:σ (x=0.12)$$σ (x=0.00)$$σ(x=0.03)$$σ (x=0.06)$$σ (x=0.09)。x=0.09的陶瓷样品在湿润空气和湿润氢气中600°C下,电导率分别达到最大值1.69×10$$sup$$-4$$/sup$$S·cm$$sup$$-1$$/sup$$和1.91×10$$sup$$-4$$/sup$$S·cm$$sup$$-1$$/sup$$。气体浓差电池电动势的测定结果表明,样品在湿润氢气气氛中是一个纯的离子导体,主要表现为质子导电,同时有部分氧离子导电。样品在湿润空气气氛中是一个离子和电子空穴的混合导体,主要表现为电子空穴导电,同时有部分离子导电。(3)第三章—TiP$$sub$$2$$/sub$$O$$sub$$7$$/sub$$基陶瓷的制备及中温电性能研究。制备了Ti$$sub$$1-x$$/sub$$Ga)$$sub$$x$$/sub$$P$$sub$$2$$/sub$$O$$sub$$7$$/sub$$(x=0,0.03,0.06,0.09)系列样品;以ZnO为烧结助剂,制备了Ti0.97Ga0.03P2O7+ywt%ZnO (y=1,2,3)陶瓷样品。XRD测试结果表明:Ti$$sub$$1-x$$/sub$$Ga$$sub$$x$$/sub$$P$$sub$$2$$/sub$$O$$sub$$7$$/sub$$的掺杂限度为3mol%,经1000°C烧结的Ti$$sub$$0.97$$/sub$$Ga$$sub$$0.03$$/sub$$P$$sub$$2$$/sub$$O$$sub$$7$$/sub$$+2wt%ZnO陶瓷样品具有单一的相结构。Ti$$sub$$0.97$$/sub$$Ga$$sub$$0.03$$/sub$$P$$sub$$2$$/sub$$O$$sub$$7$$/sub$$+2wt%ZnO样品在空气中600°C时电导率达最大值为8.02×10$$sup$$-5$$/sup$$S·cm-1。在较高氧分压(约10-5$$sup$$1$$/sup$$atm)范围内,电导率与氧分压的变化无关,表明在该氧分压范围内样品为纯的离子导体;而在低氧分压(约10$$sup$$-5$$/sup$$$$sup$$1$$/sup$$0$$sup$$-20$$/sup$$atm)范围内,电导率随着氧分压的降低而升高,表明样品在该氧分压范围内具有一定的电子导电性,是离子与电子的混合导体。气体浓差电池电动势的测定结果表明,样品Ti$$sub$$0.97$$/sub$$Ga$$sub$$0.03$$/sub$$P$$sub$$2$$/sub$$O$$sub$$7$$/sub$$+2wt%ZnO在湿润氢气气氛中是一个离子和电子的混合导体,在湿润氧气气氛中几乎是一个纯的离子导体,主要表现为氧离子导电,同时有部分质子导电。
As we all know, inorganic proton conductor is a kind of important functionalmaterials for many potential electrochemical applications such as fuel cell, hydrogensensor, ammonia synthesis at atmospheric pressure, etc.Recently, a novel intermediate temperature inorganic proton conductor–pyrophosphate (MP$$sub$$2$$/sub$$O$$sub$$7$$/sub$$) has aroused a great interest. MP$$sub$$2$$/sub$$O$$sub$$7$$/sub$$based ionic conductionmaterials have high proton conductivity in the temperature range of100―600°C, andinsoluble in water, good thermal stability. Until now, the effect of Zn$$sup$$2+$$/sup$$doping level onphase purity and electrochemical properties of Zn$$sup$$2+$$/sup$$-doped SnP2O7and Ga$$sup$$3+$$/sup$$-dopedTiP$$sub$$2$$/sub$$O$$sub$$7$$/sub$$ionic conduction ceramic material have yet not been reported.Therefore, in the thesis,we focused on the conduction behaviors at intermediatetemperature of MP$$sub$$2$$/sub$$O$$sub$$7$$/sub$$based conduction materials. Main works and results in this paperare as follows:(1) Chapter1—Introduction. We introduced briefly some typical solid electrolytematerials, inorganic proton conductor, concerned defect chemistry, proton transferencemechanism, and their applications. In addition, we summarized the internal and externalresearch background on MP$$sub$$2$$/sub$$O$$sub$$7$$/sub$$-based intermediate temperature electrolyte materials,proposed the present theme and the research meaning.(2) Chapter2—Preparation and intermediate temperature conducting performancesof Sn1-xZnxP2O7. A series of Sn1-xZnxP2O7(x=0,0.03,0.06,0.09,0.12) ceramic samplewere prepared. The doping limit of Zn$$sup$$2+$$/sup$$in SnP2O7is9mol%. The dopant content x inthe samples remarkably influenced the conduction properties. Conductivities increasedin the order: σ (x=0.12)$$σ (x=0.00)$$σ (x=0.03)$$σ (x=0.06)$$σ (x=0.09).Thehighest conductivities were observed for the sample of x=0.09to be1.69×10$$sup$$-4$$/sup$$S·cm$$sup$$-1$$/sup$$in wet air and1.91×10$$sup$$-4$$/sup$$S·cm$$sup$$-1$$/sup$$in wet hydrogen at600°C. The results of the gasconcentration cells suggested that in wet hydrogen atmosphere Sn$$sub$$0.91$$/sub$$Zn$$sub$$0.09$$/sub$$P$$sub$$2$$/sub$$O$$sub$$7$$/sub$$wasalmost a
the ionic conduction was contributed mainly to proton and partially to oxide-ion, whereas in wet air atmosphere, the sample was a mixedconductor, and the conduction was contributed mainly to electron hole partially to ion.(2) Chapter3—Preparation and intermediate temperature conducting performancesof TiP$$sub$$2$$/sub$$O$$sub$$7$$/sub$$based ceramic. A series of Ti$$sub$$1-x$$/sub$$Ga$$sub$$x$$/sub$$P$$sub$$2$$/sub$$O$$sub$$7$$/sub$$(x=0,0.03,0.06,0.09) sample andTi$$sub$$0.97$$/sub$$Ga$$sub$$0.03$$/sub$$P$$sub$$2$$/sub$$O$$sub$$7$$/sub$$+y wt%ZnO (y=1,2,3) ceramic sample were prepared. The dopinglimit of Ga$$sup$$3+$$/sup$$in TiP$$sub$$2$$/sub$$O$$sub$$7$$/sub$$is3mol%.Ti$$sub$$0.97$$/sub$$Ga$$sub$$0.03$$/sub$$P$$sub$$2$$/sub$$O$$sub$$7$$/sub$$+2wt%ZnO is of single phasestructure through sintering at1000°C. The highest conductivity was observed forTi$$sub$$0.97$$/sub$$Ga$$sub$$0.03$$/sub$$P$$sub$$2$$/sub$$O$$sub$$7$$/sub$$+2wt%ZnO to be8.02×10$$sup$$-5$$/sup$$S·cm$$sup$$-1$$/sup$$in air at600°C. In high oxygenpartial pressure range (pO2=10-5$$sup$$1$$/sup$$atm), the conductivity was independent of oxygenpartial pressure, indiating that the sample was almost pure ionic conductor. Whereas inlow oxygen partial pressure (pO$$sub$$2$$/sub$$=10-5$$sup$$1$$/sup$$0$$sup$$-20$$/sup$$atm), the conductivity increased with thedecreasing oxygen partial pressure, indicating that it was a mixed conductor of ion andelectron. The results of the gas concentration cells suggested that in wet hydrogenatmosphere Ti$$sub$$0.97$$/sub$$Ga$$sub$$0.03$$/sub$$P$$sub$$2$$/sub$$O$$sub$$7$$/sub$$+2wt%ZnO was a mixed conductor of ion and electron.Whereas in wet air atmosphere Ti$$sub$$0.97$$/sub$$Ga$$sub$$0.03$$/sub$$P$$sub$$2$$/sub$$O$$sub$$7$$/sub$$+2wt%ZnO was almost a pure ionicconductor, the ionic conduction was contributed mainly to proton and partially tooxide-ion.
上一篇:下一篇:
LaBaCuCo(Fe)O5+δ基层状钙
本类论文推荐
LaBaCuCo(Fe)O5+δ基层状钙已知椭圆x^2/a^2+y^2/b^2=1(a&b&0)的左.右焦点分别为F1,F2,其半焦距为c
已知椭圆x^2/a^2+y^2/b^2=1(a&b&0)的左.右焦点分别为F1,F2,其半焦距为c,圆M的方程(x-5c/3)^2+y^2=16c^2/9(1)若P是圆M上的任意一点,求证PF1:PF2为定值(2)若椭圆经过圆上一点Q,且cos&F1QF2=11/16,求椭圆的离心率
09-06-01 &
已知P为椭圆x^2/a^2+y^2/b^2=1(a&b&0)上一点,F1,F2为椭圆的焦点,角F1PF2的外角平分线为L,过点F2作直线L的垂线,垂足为R ,求R的轨迹方程 解: 不妨设F1(-c,0), F2(c,0) P(x,y) 做∠F1PF2外角平分线L,连PF1,PF2。做F2R⊥L,R为垂点。 延长F2Q交F1P延长线于Q。 ∵∠QPR=∠F2PR PR⊥F2Q ∴PQ=PF2 P(u,v) x=(c+u)/2 u=2x-c y=(0+v)/2 v=2y QF1=PQ+PF1=F1F2=2a=√[(2x-c+c)^+(2y)^]=(2a)^ ∴x^+y^=a^既为R的轨迹方程
请登录后再发表评论!
a&b&0,椭圆c:x^2/a^2+y^2/b^2=1,F1,F2分别为其左、右焦点,点P(√2,1)在椭圆C上,且PF2⊥x轴。 c=√2,a^2=c^2+b^2=2+b^2 x^2/a^2+y^2/b^2=1 点P(√2,1)在椭圆C上 2/(2+b^2)+1/b^2=1 b^2=2,a^2=2+2=4 (1)椭圆C的方程:x^2/4+y^2/2=1 A(-5,-4)B(3,0),过点P做直线L,交线段AB于点D,并且直线l将三角形APB分成的两部分图形的面积之比为5:3 k(AB)=0.5 直线AB:y=0.5*(x-3)=0.5x-1.5,D(d,0.5d-1.5) 直线l将三角形APB分成的两部分图形的面积之比为5:3,则以AD、BD为底的△,高相等,故L将三角形APB分成的两部分图形的面积之比=5:3=AD/BD,或者=BD/AD 一、AD/BD=(xD-xA)/(xB-xD)=5/3 (d+5)/(3-d)=5/3 d=0,0.5d-1.5=-1.5 D(0,-1.5) 二、BD/AD=5/3 (3-d)/(d+5)=5/3 d=-2,0.5d-1.5=-2.5 D(-2,-2.5) 答: (1)椭圆C的方程:x^2/4+y^2/2=1 (2)D点的坐标有两个,即D(0,-1.5) ,或者D(-2,-2.5)
请登录后再发表评论!今天看啥 热点:
【本文链接】
/hellogiser/p/find-k-missing-numbers-from-1-to-n.html
从1到n,共有n个数字(无序排列),每个数字只出现一次。现在随机拿走一个数字x,请给出最快的方法,找到这个数字。要求时间复杂度为O(n),空间复杂度为O(1)。如果随机拿走k(k&=2)个数字呢?
题目给出的条件很强,数字是从1~n的数字,限制了数字的范围;每个数字只出现一次,限制了数字出现的次数;随即拿走了一个数字,说明只有一处是与其他不同、不符合规律的。我们可以利用这些特点来选择合适的解法。
(1)Hash法。利用Hash法统计数字出现的次数,次数为0的即为所求。时间复杂度O(n),空间复杂度O(n)。通常这不是面试、笔试时想要的答案,但是Hash的优势在于其通用性。
(2)排序法。利用快排,得到排序后的数组,然后顺序遍历,统计次数为0的数字。时间复杂度O(nlgn),空间复杂度O(1)。其时间复杂度略高,通常也不是面试官期待的解法,但排序法也算是一种通用做法。
(3)元素相乘/相加法。时间复杂度O(n),空间复杂度O(1)。
元素相乘法:由于只有一个元素被拿走,因此我们只需要先算出n的阶乘n!,再除以现存所有数字的乘积M,即可得到拿走的数字x (x=n!/M)。但是且缺陷是n不能太大,否则会溢出。
元素相加法:先算出从1到n的所有数字的和Sn,然后减去现有所有数字的和sum,即可得到拿走的数字x(x=Sn-sum)。元素相加法比元素相乘要更好一些。
(4)位运算。时间复杂度O(n),空间复杂度O(1)。
位运算法如果可以使用的话,应该是计算最快的方法。但是位运算对条件要求也较苛刻,一般需要元素有特殊规律,才有可能使用这种方法。在本题目中,对1~n所有元素进行xor运算得到A=1^2^3^&^(x-1)^x^(x+1)^&^n,在对取走一个元素后剩下的元素进行xor运算得到B=1^2^3^&^(x-1)^(x+1)^&^n,二者xor即可得拿走的数字x = A^B。因为在A^B的过程中相同的数字都被抵消掉了,剩余的结果即为x。
&C++ Code&
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
//&61_FindMissingNumberFrom1toN.cpp&:&Defines&the&entry&point&for&the&console&application.
&&&&version:&1.0
&&&&author:&hellogiser
&&&&blog:&/hellogiser
&&&&date:&
#include&"stdafx.h"
A=1^2^3^...^(x-1)^x^(x+1)^...^n
B=1^2^3^...^(x-1)^(x+1)^...^n
1,2,3,4,6,7,8,9
int&FindMissingNumberFrom1ToN(int&data[],&int&n)
&&&&int&length&=&n&-&1;
&&&&if(NULL&==&data&||&length&&=&0)
&&&&&&&&return&-1;
&&&&//&xor&all
&&&&int&xor_all&=&0;
&&&&for(int&i&=&1;&i&&=&n;&i++)
&&&&&&&&xor_all&^=&i;
&&&&//&xor&of&current&array
&&&&int&xor_current&=&0;
&&&&for(int&i&=&0;&i&&&&i++)
&&&&&&&&xor_current&^=&data[i];
&&&&//get&result
&&&&int&result&=&xor_all&^&xor_
&&&&return&
void&test_base(int&data[],&int&n)
&&&&int&result&=&FindMissingNumberFrom1ToN(data,&n);
&&&&printf("%d&\n",&result);
void&test_case1()
&&&&int&data[]&=&{1,&2,&3};
&&&&int&length&=&sizeof(data)&/&sizeof(int);
&&&&test_base(data,&length&+&1);
void&test_case2()
&&&&int&data[]&=&{2,&3,&4};
&&&&int&length&=&sizeof(data)&/&sizeof(int);
&&&&test_base(data,&length&+&1);
void&test_case3()
&&&&int&data[]&=&{1,&2,&3,&4,&6,&7,&8,&9};
&&&&int&length&=&sizeof(data)&/&sizeof(int);
&&&&test_base(data,&length&+&1);
void&test_main()
&&&&test_case1();
&&&&test_case2();
&&&&test_case3();
int&_tmain(int&argc,&_TCHAR&*argv[])
&&&&test_main();
&&&&return&0;
如果随机拿走两个数字呢?如果随机拿走k(k&2)个数字呢?
(1)(2)是通用做法,仍适合。
(3)扩展:
K=1时,构造2个等式。
Sa = 1+2+&(x-1)+x+(x+1)&+n
Sb = 1+2+&(x-1)+(x+1)&+n
K=2时,构造4个等式。
S2a = 12+22+&+x2+&+y2+&+n
S2b = 12+22+&(x-1)2+(x+1)2&+(y-1)2+(y+1)2&+n
S1a = 1+2+&+x+&+y+&+n
S1b = 1+2+&(x-1)+(x+1)&+(y-1)+(y+1)&+n
则有x2+y2=S2a-S2b,x+y =S1a-S1b。可以求解得到x和y。
同理(k&2),构造2*k个等式,可以得到关于k个数的k个方程,求解即可得到k个数字。
(4)扩展:
思考一下,如何扩展?
【本文链接】
/hellogiser/p/find-k-missing-numbers-from-1-to-n.html
相关搜索:
相关阅读:
相关频道:
&&&&&&&&&&&&&&&&
C++教程最近更新From Wikipedia, the free encyclopedia
ALGOL 68 (short for ALGOrithmic Language 1968) is an
that was conceived as a successor to the
programming language, designed with the goal of a much wider scope of application and more rigorously defined syntax and semantics.
The contributions of ALGOL 68 to the field of
have been deep, wide ranging and enduring, although many of these contributions were only publicly identified when they had reappeared in subsequently developed programming languages.
ALGOL 68 features include expression-based syntax, user-declared types and structures/tagged-unions, a reference model of variables and reference parameters, string, array and matrix slicing, and also concurrency.
ALGOL 68 was designed by the . On December 20, 1968, the language was formally adopted by Working Group 2.1 and subsequently approved for publication by the General Assembly of IFIP.
ALGOL 68 was defined using a two-level grammar formalism invented by .
to generate an infinite set of productions that will recognize a particular ALGOL 68 notably, they are able to express the kind of requirements that in many other programming language standards are labelled "semantics" and have to be expressed in ambiguity-prone natural language prose, and then implemented in compilers as ad hoc code attached to the formal language parser.
The main aims and principles of design of ALGOL 68:
Completeness and clarity of description
Efficiency:
Static mode checking
Mode-independent parsing
Independent compilation
Loop optimization
Representations – in minimal & larger character sets
ALGOL 68 was the first (and possibly one of the last) major language for which a full formal definition was made before it was implemented.
ALGOL 68 has been criticized, most prominently by some members of its design committee such as
and , for abandoning the simplicity of , becoming a vehicle for complex or overly general ideas, and doing little to make the
writer's task easier, in contrast to deliberately simple contemporaries (and competitors) such as ,
became the first working compiler for ALGOL 68.
In the 1973 revision, certain features – such as ,
– were omitted. C.f.
Though European defence agencies (in Britain
– RSRE) promoted the use of ALGOL 68 for its expected security advantages, the American side of the NATO alliance decided to develop a different project, the , making its use obligatory for US defense contracts.
Algol 68 also had a notable influence within the Soviet Union, details of which can be found in 's 2014 paper: "" and .
, who was on the Algol 68 revision committee, took some of its ideas to his
(and thereby, to descendant
such as ) and to
(and thereby to descendants such as ).
The complete history of the project can be found in 's A History of ALGOL 68.
For a full-length treatment of the language, see
by Dr. Sian Mountbatten, or
by Dr. Marcel van der Veer which includes the Revised Report.
Contributor
Issue 1 (First)
Algol 68 Final Report Presented at Munich Meeting
IFIP Working Group 2.1
Meeting in Tirrenia, Italy
IFIP Working Group 2.1
Meeting in North Berwick, Scotland
IFIP Working Group 2.1
ALGOL 68 Final Report Presented at Munich Meeting
IFIP Working Group 2.1
IFIP Working Group 2.1
(C) - transportable compiler (zcode )
Strathclyde ALGOL 68 conference, Scotland
A. P. Black, V. J. Rayward-Smith
Full (S) compiler for Sun, SPARC, and PCs
C.H. Lindsey ea, Manchester
Issue 52 (last)
Ed. C.H. Lindsey / ACM
(GNU GPL open source licensing)
Marcel van der Veer
Mar. 1968: Draft Report on the Algorithmic Language ALGOL 68 - Edited by: , ,
"Van Wijngaarden once characterized the four authors, somewhat tongue-in-cheek, as: Koster: , Peck: syntaxer, Mailloux: implementer, Van Wijngaarden: party ideologist." – Koster.
Oct. 1968: Penultimate Draft Report on the Algorithmic Language ALGOL 68 – Chapters 1-9 Chapters 10-12 – Edited by: A. van Wijngaarden, B.J. Mailloux, J.E.L. Peck and C.H.A. Koster.
Dec. 1968: Report on the Algorithmic Language ALGOL 68 – Offprint from Numerische Mathematik, 14, 79-218 (1969); Springer-Verlag. – Edited by: A. van Wijngaarden, B.J. Mailloux, J.E.L. Peck and C.H.A. Koster.
WG 2.1 members active in the original design of ALGOL 68:
o ※ o ※ o ※ o
o ※ o Aad van Wijngaarden o ? o ※ Key: ※Signatories to the Minority Report. ?Resigned after [MR 93].
Sep. 1973: Revised Report on the Algorithmic Language Algol 68 - Springer-Verlag 1976 - Edited by: A. van Wijngaarden, B.J. Mailloux, , C.H.A. Koster, , ,
1968: On December 20, 1968, the "Final Report" (MR 101) was adopted by the Working Group, then subsequently approved by the General Assembly of 's
for publication. Translations of the standard were made for , ,
and , and then later
and . The standard was also made available in .
considered Algol 68 for standardisation as "New Work Item" TC97/N1642 . West Germany, Belgium, Netherlands, USSR and Czechoslovakia willing to participate in preparing the standard but the USSR and Czechoslovakia "were not the right kinds of member of the right ISO committees" and Algol 68's ISO standardisation stalled.
1988: Subsequently ALGOL 68 became one of the
standards in Russia.
GOST 27974-88 Programming language ALGOL 68 – Язык программирования АЛГОЛ 68
GOST 27975-88 Programming language ALGOL 68 extended – Язык программирования АЛГОЛ 68 расширенный
There are about 60 such reserved words (some with "brief symbol" equivalents) in the standard language:
mode, op, prio, proc,
flex, heap, loc, long, ref, short,
bits, bool, bytes, char, compl, int, real, sema, string, void,
channel, file, format, struct, union,
at "@", either, is ":=:", isnt
is not ":/=:" ":≠:", of "→", true, false, empty, nil "○", skip "~",
co "?", comment "?", pr, pragmat,
case ~ in ~ ouse ~ in ~ out ~ esac "( ~ | ~ |: ~ | ~ | ~ )",
for ~ from ~ to ~ by ~ while ~ do ~ od,
if ~ then ~ elif ~ then ~ else ~ fi "( ~ | ~ |: ~ | ~ | ~ )",
par begin ~ end "( ~ )", go to, goto, exit ".".
The basic language construct is the unit. A unit may be a formula, an enclosed clause, a routine text or one of several technically needed constructs (assignation, jump, skip, nihil). The technical term enclosed clause unifies some of the inherently bracketing constructs known as block, do statement, switch statement in other contemporary languages. When keywords are used, generally the reversed character sequence of the introducing keyword is used for terminating the enclosure, e.g. ( if ~ then ~ else ~ fi, case ~ in ~ out ~ esac, for ~ while ~ do ~ od ). This
syntax was reused by
in the common
. An expression may also yield a multiple value, which is constructed from other values by a collateral clause. This construct just looks like the parameter pack of a procedure call.
This article contains Unicode 6.0 "" characters. Without proper , you may see
instead of something like "??" ().
(called modes in Algol 68 parlance) are real, int, compl (), bool, char, bits and bytes. For example:
int n = 2;
co n is fixed as a constant of 2. co
int m := 3;
co m is a newly created local variable whose value is initially set to 3. co
This is short for ref int m = loc int := 3; co
real avogadro = 6.; co Avogadro's number co
long long real long long pi = 3.
compl square root of minus one = 0 ⊥ 1;
However, the declaration real is just
for ref real x = loc real;. That is, x is really the constant identifier for a reference to a newly generated local real variable.
Furthermore, instead of defining both float and double, or int and long and short, etc., ALGOL 68 provides modifiers, so that the presently common double would be written as long real or long long real instead, for example. The prelude constants max real and min long int are provided to adapt programs to different implementations.
All variables need to be declared, the declaration does not have to appear prior to the first use.
primitive-declarer: int, real, compl, complexG, bool, char, string, bits, bytes, format, file, pipeG, channel, sema
bits - a "packed vector" of bool.
bytes - a "packed vector" of char.
string - a flexible array of char.
which can be initialised with the operator level.
Complex types can be created from simpler ones using various type constructors:
ref mode - a reference to a value of type mode, similar to & in C/C++ and ref in Pascal
struct - used to build structures, like struct in C/C++ and record in Pascal
union - used to build unions, like in C/C++ and Pascal
proc - used to specify procedures, like functions in C/C++ and procedures/functions in Pascal
For some examples, see .
Other declaration symbols include: flex, heap, loc, ref, long, short, eventS
flex - declare the array to be flexible, i.e. it can grow in length on demand.
heap - allocate variable some free space from the global heap.
loc - allocate variable some free space of the local stack.
long - declare an int, real or compl to be of a longer size.
short - declare an int, real or compl to be of a shorter size.
A name for a mode (type) can be declared using a mode declaration, which is similar to typedef in C/C++ and type in Pascal:
int max=99;
mode newmode = [0:9][0:max]struct (
long real a, b, c, short int i, j, k, ref real r
This is similar to the following C code:
const int max=99;
typedef struct {
double a, b, c; short i, j, k; float *r;
} newmode[9+1][max+1];
Note that for ALGOL 68 only the newmode mode-indication appears to the left of the equals symbol, and most notably the construction is made - and can be read - from left to right without regard to priorities. Note also that the lower bound of Algol 68 arrays is one by default, but can be any integer from -max int to max int.
Mode declarations allow types to be recursive: defined directly or indirectly in terms of themselves. This is subject to some restrictions - for instance, these declarations are illegal:
mode A = ref A
mode A = struct (A a, B b)
mode A = proc (A a) A
while these are valid:
mode A = struct (ref A a, B b)
mode A = proc (ref A a) ref A
produce a coercee from a coercend according to three criteria: the a priori mode of the coercend before the application of any coercion, the a posteriori mode of the coercee required after those coercions, and the syntactic position or "sort" of the coercee. Coercions may be cascaded.
There are six possible coercions, termed "deproceduring", "dereferencing", "uniting", "widening", "rowing" and "voiding". Each coercion, except for "uniting", prescribes a corresponding dynamic effect on the associated values. Hence, a number of primitive actions can be programmed implicitly by coercions.
Context strength – allowed coercions:
soft – deproceduring
weak – dereferencing or deproceduring, yielding a name
meek – dereferencing or deproceduring
firm – meek, followed by uniting
strong – firm, followed by widening, rowing or voiding
ALGOL 68 has a hierarchy of contexts which determine which kind of coercions are available at a particular point in the program. These contexts are:
Context location
Coercions available in this context
Coercion examples
Right hand side of:
Identity-declarations, as "~" in:
REAL x = ~
Initialisations, as "~" in:
REAL x := ~
Actual-parameters of calls, as "~" in:
PROC: sin(~)
Enclosed clauses of casts, as "~" in:
Units of routine-texts
Statements yielding VOID
All parts (but one) of a balanced clause
One side of an identity relation, as "~" in:
deproceduring
All soft then weak dereferencing (dereferencing or deproceduring, yielding a name)
All weak then dereferencing (dereferencing or deproceduring)
All meek then uniting
All firm then widening, rowing or voiding
Widening occurs if there is no loss of precision. For example: An INT will be coerced to a REAL, and a REAL will be coerced to a LONG REAL. But not vice-versa. Examples:
INT to LONG INT
INT to REAL
REAL to COMPL
BITS to []BOOL
BYTES to STRING
A variable can also be coerced (rowed) to an array of length 1.
For example:
INT to [1]INT
REAL to [1]REAL
Operands of formulas as "~" in:
Parameters of transput calls
UNION(INT,REAL) var := 1
Trimscripts (yielding INT)
Enquiries: e.g. as "~" in the following
IF ~ THEN ... FI
FROM ~ BY ~ TO ~ WHILE ~ DO ... OD etc
Primaries of calls (e.g. sin in sin(x))
REF REF BOOL to BOOL
REF REF REF INT to INT
Primaries of slices, as in "~" in:
Secondaries of selections, as "~" in:
value OF ~
REF BOOL to REF BOOL
REF REF INT to REF INT
REF REF REF REAL to REF REAL
REF REF REF REF STRUCT to REF STRUCT
The LHS of assignments, as "~" in:
deproceduring of:
PROC REAL random: e.g. random
For more details about Primaries, Secondaries, Tertiary & Quaternaries refer to .
Pragmats are
in the program, typically h in newer languages these are called "pragmas" (no 't'). e.g.
pragmat heap=32 pragmat
pr heap=32 pr
Comments can be inserted in a variety of ways:
? The original way of adding your 2 cents worth to a program ?
comment "bold" comment comment
co Style i comment co
# Style ii comment #
? This is a hash/pound comment for a UK keyboard ?
Normally, comments cannot be nested in ALGOL 68. This restriction can be circumvented by using different comment delimiters (e.g. use hash only for temporary code deletions).
ALGOL 68 being an , the value returned by an
statement is a reference to the destination. Thus, the following is valid ALGOL 68 code:
real half pi, one pi := 2 * ( half pi := 2 * arc tan(1) )
This notion is present in
and , among others. Note that as in earlier languages such as
and , spaces are allowed in identifiers, so that half pi is a single identifier (thus avoiding the underscores versus
versus all lower-case issues).
As another example, to express the mathematical idea of a sum of f(i) from i=1 to n, the following ALGOL 68 integer expression suffices:
(int sum := 0; for i to n do sum +:= f(i) od; sum)
Note that, being an integer expression, the former block of code can be used in any context where an integer value can be used. A block of code returns the value of the last exp this idea is present in , among other languages.
Compound statements are all terminated by distinctive (and somewhat reverent) closing brackets:
if choice clauses:
if condition then statements [ else statements ] fi
"brief" form:
( condition | statements | statements )
if condition1 then statements elif condition2 then statements [ else statements ] fi
"brief" form:
( condition1 | statements |: condition2 | statements | statements )
This scheme not only avoids the
problem but also avoids having to use begin and end in embedded
sequences.
case choice clauses:
case switch in statements, statements,... [ out statements ] esac
"brief" form:
( switch | statements,statements,... | statements )
case switch1 in statements, statements,... ouse switch2 in statements, statements,... [ out statements ] esac
"brief" form of case statement:
( switch1 | statements,statements,... |: switch2 | statements,statements,... | statements )
Choice clause example with Brief symbols:
proc days in month = (int year, month)int:
(year÷×4=0 ∧ year÷×100≠0
year÷×400=0 | 29 | 28 ),
31, 30, 31, 30, 31, 31, 30, 31, 30, 31
Choice clause example with Bold symbols:
proc days in month = (int year, month)int:
case month in
if year mod 4 eq 0 and year mod 100 ne 0
year mod 400 eq 0 then 29 else 28 fi,
31, 30, 31, 30, 31, 31, 30, 31, 30, 31
Choice clause example mixing Bold and Brief symbols:
proc days in month = (int year, month)int:
case month in
?Feb? ( year mod 4 = 0 and year mod 100 ≠ 0
year mod 400 = 0 | 29 | 28 ),
?Mar? 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ? to Dec. ?
Algol68 allowed the switch to be of either type int or (uniquely) union. The latter allows the enforcing
onto union variables. c.f.
below for example.
loop clause:
[ for index ] [ from first ] [ by increment ] [ to last ] [ while condition ] do statements od
The minimum form of a "loop clause" is thus: do statements od
This was considered the "universal" loop, the full syntax is:
for i from 1 by 1 to 3 while i≠4 do ~ od
There are several unusual aspects of the construct:
only the do ~ od portion was compulsory, in which case the loop will iterate indefinitely.
thus the clause to 100 do ~ od, will iterate only 100 times.
the while "syntactic element" allowed a programmer to break from a for loop early. e.g.
int sum sq:=0;
print(("So far:",i,newline));
sum sq≤1000
sum sq+:=i↑2
Subsequent "extensions" to the standard Algol68 allowed the to syntactic element to be replaced with upto and downto to achieve a small optimisation. The same compilers also incorporated:
until(C) - for late loop termination.
foreach(S) - for working on arrays in .
Further examples can be found in the code examples below.
ALGOL 68 supports
with any number of dimensions, and it allows for the slicing of whole or partial rows or columns.
mode vector = [1:3]
# vector mode declaration (typedef)
mode matrix = [1:3,1:3]real;
# matrix mode declaration (typedef)
:= (1,2,3);
# array variable initially (1,2,3)
= (4,5,6);
# constant array, type equivalent to vector, bounds are implied
op + = (vector a,b) vector:
# binary operator definition
(vector for i from ?a to ?a do out[i] := a[i]+b[i] od; out);
matrix m := (v1, v2, v1+v2);
print ((m[,2:]));
# a slice of the 2nd and 3rd columns #
Matrices can be sliced either way, e.g.:
ref vector row = m[2,];
# define a ref (pointer) to the 2nd row #
ref vector col = m[,2];
# define a ref (pointer) to the 2nd column #
ALGOL 68 supports multiple field structures (struct) and . Reference variables may point to any mode including array slices and structure fields.
For an example of all this, here is the traditional linked list declaration:
mode node = union (real, int, compl, string),
list = struct (node val, ref list next);
Usage example for union case of node:
Algol68 as in the 1968 Final Report
node n := "1234";
real int compl string s
case r,i,c,s::=n in
print(("real:", r)),
print(("int:", i)),
print(("compl:", c)),
print(("string:", s))
out print(("?:", n))
Algol68 as in the 1973 Revised Report
node n := "1234";
print(("real:", r)),
print(("int:", i)),
(compl c):
print(("compl:", c)),
(string s): print(("string:", s))
print(("?:", n))
Procedure (proc) declarations require type specifications for both the parameters and the result (void if none):
proc max of real = (real a, b) real:
if a & b then a else b fi;
or, using the "brief" form of the conditional statement:
proc max of real = (real a, b) real: (a&b | a | b);
The return value of a proc is the value of the last expression evaluated in the procedure. References to procedures (ref proc) are also permitted.
parameters are provided by specifying references (such as ref real) in the formal argument list. The following example defines a procedure that applies a function (specified as a parameter) to each element of an array:
proc apply = (ref [] real a, proc (real) real f):
for i from lwb a to upb a do a[i] := f(a[i]) od
This simplicity of code was unachievable in ALGOL 68's predecessor .
The programmer may define new
and both those and the pre-defined ones may be
and their priorities may be changed by the coder. The following example defines operator max with both dyadic and monadic versions (scanning across the elements of an array).
prio max = 9;
op max = (int a,b) int: ( a&b | a | b );
op max = (real a,b) real: ( a&b | a | b );
op max = (compl a,b) compl: ( abs a & abs b | a | b );
op max = ([]real a) real:
(real out := a[lwb a];
for i from lwb a + 1 to upb a do ( a[i]&out | out:=a[i] ) od;
Operation &
Effectively 12
dereferencing, deproceduring(~,~), subscripting[~], rowing[~,], slicing[~:~], size denotations long & short
proceduring
currying(~,,,), diag, trnsp, row, col
Effectively 11
(Secondary)
of (selection), loc & heap (generators)
→ (selection)
new (generators)
These are technically not operators, rather they are considered ""
(Tertiary)
Algol68 "Worthy characters"&
+Algol68C,G
not ~, up, down, lwb, upb,
-, abs, arg, bin, entier, leng, level, odd, repr, round, shorten
?, ↑, ↓, ?, ?
norm, trace, t, det, inv
lws, ups, ?, ?, btb, ctb
(Tertiary)
Algol68 "Worthy characters"&
+Algol68C,G
shl, shr, **, up, down, lwb, upb
↑, ↓, ?, ?
××, ^, lws, ups, ?, ?
*, /,  %, over,  %*, mod, elem
×, ÷, ÷×, ÷*, %×, □
&, lt, &=, le, &=, ge, &, gt
eq =, ne ~= /=
minusab, plusab, timesab, divab, overab, modab, plusto,
-:=, +:=, *:=, /:=, %:=, %*:=, +=:
×:=, ÷:=, ÷×:=, ÷*:=,  %×:=
minus, plus, div, overb, modb, ÷::=, prus
Note: Tertiaries include names nil and ○.
These are technically not operators, rather they are considered ""
(Quaternaries)
Algol68 "Worthy characters"&
+Algol68C,G,R
Effectively 0
 :=, is :=:, isnt :/=: :~=:, at @, ":", ";"
 :≠: :?=:
 :=:=C, =:=R
..=, .=, ct, ::, ctab, ::=, .., is not, "..", ".,"
Note: Quaternaries include names skip and ~.
":=:" (alternatively "is") tests if tw ":/=:" (alternatively "isnt") tests if they are unequal.
Why :=: and :/=: are needed: Consider trying to compare two pointer values, such as the following variables, declared as pointers-to-integer:
ref int ip, jp
Now consider how to decide whether these two are pointing to the same location, or whether one of them is pointing to nil. The following expression
will dereference both pointers down to values of type int, and compare those, since the "=" operator is defined for int, but not ref int. It is not legal to define "=" for operands of type ref int and int at the same time, because then calls become ambiguous, due to the implicit coercions that can be applied: should the operands be left as ref int and that version of the operator called? Or should they be dereferenced further to int and that version used instead? Therefore the following expression can never be made legal:
Hence the need for separate constructs not subject to the normal coercion rules for operands to operators. But there is a gotcha. The following expressions:
ip :=: jp
ip :=: nil
while legal, will probably not do what might be expected. They will always return false, because they are comparing the actual addresses of the variables ip and jp, rather than what they point to. To achieve the right effect, one would have to write
ip :=: ref int(jp)
ip :=: ref int(nil)
Patent application: On 14 May 2003,
application No.
was filed for the ISNOT operator by employees of . This patent was granted on 18 November 2004.
This article contains Unicode 6.0 "" characters. Without proper , you may see
instead of something like "??" ().
Most of Algol's "special" characters (×, ÷, ≤, ≥, ≠, ?, ?, ≡, ∨, ∧, →, ↓, ↑, ?, ?, ?, ?, ⊥, ?, ?, ○ and □) can be found on the
keyboard with the
"golf-ball" print head inserted, these became available in the mid-1960s while ALGOL 68 was being drafted. These characters are also part of the
standard and most of them are available in several popular :
Transput is the term used to refer to ALGOL 68's input and output facilities. There are pre-defined procedures for unformatted, formatted and binary transput. Files and other transput devices are handled in a consistent and machine-independent manner. The following example prints out some unformatted output to the standard output device:
print ((newpage, "Title", newline, "Value of i is ",
i, "and x[i] is ", x[i], newline))
Note the predefined procedures newpage and newline passed as arguments.
The transput is considered to be of books, channels and files:
Books are made up of pages, lines and characters, and may be backed up by files.
A specific book can be located by name with a call to match.
channels correspond to physical devices. e.g. card punches and printers.
There are three standard channels: stand in channel, stand out channel, stand back channel.
A file is a means of communicating between a particular program and a book that has been opened via some channel.
The mood of a file may be read, write, char, bin, and opened.
transput procedures include: establish, create, open, associate, lock, close, scratch.
position enquires: char number, line number, page number.
layout routines include:
space, backspace, newline, newpage.
get good line, get good page, get good book, and proc set=(ref file f, int page,line,char)void:
A file has event routines. e.g. on logical file end, on physical file end, on page end, on line end, on format end, on value error, on char error.
"Formatted transput" in ALGOL 68's transput has its own syntax and patterns (functions), with formats embedded between two $ characters.
printf (($2l"The sum is:"x, g(0)$, m + n)); ? prints the same as: ?
print ((new line, new line, "The sum is:", space, whole (m + n, 0))
ALGOL 68 supports programming of parallel processing. Using the keyword par, a collateral clause is converted to a parallel clause, where the synchronisation of actions is controlled using . In A68G the parallel actions are mapped to threads when available on the hosting . In A68S a different paradigm of parallel processing was implemented (see below).
int initial foot width = 5;
mode foot = struct(
string name,
sema width,
bits toe ? packed vector of BOOL ?
foot left foot:= foot("Left", level initial foot width, 2r11111),
right foot:= foot("Right", level initial foot width, 2r11111);
? 10 round clip in a 1968
sema rounds = level 10;
? the Magnum needs more barrels to take full advantage of parallelism ?
sema acquire target = level 1;
prio ∧:= = 1;
op ∧:= = (ref bits lhs, bits rhs)ref bits: lhs := lhs ∧
proc shoot = (ref foot foot)void: (
print("BANG! ");
↓width →
toe → foot ∧:= ?(bin 1 shl level width → foot);
printf(($g": Ouch!! - "5(g)l$, name → foot, []bool(toe → foot)[bits width - initial foot width + 1:]));
↑acquire target
? do shooting in parallel to cater for someone hoping to stand on just one foot ?
for toe to initial foot width do
shoot(left foot)
od, ? &= a comma is required ?
for toe to initial foot width do
shoot(right foot)
This sample program implements the
to find all the
that are less than 100. nil is the ALGOL 68 analogue of the null pointer in other languages. The notation x of y accesses a member x of a struct y.
begin # Algol-68 prime number sieve, functional style #
proc error = (string s) void:
(print(( newline, " error: ", s, newline)); goto stop);
proc one to = (int n) list:
(proc f = (int m,n) list: (m&n | nil | cons(m, f(m+1,n))); f(1,n));
mode list = ref node;
mode node = struct (int h, list t);
proc cons = (int n, list l) list: heap node := (n,l);
= (list l) int: ( l is nil | error("hd nil"); skip | h of l );
= (list l) list: ( l is nil | error("tl nil"); skip | t of l );
proc show = (list l) void: ( l isnt nil | print((" ",whole(hd(l),0))); show(tl(l)));
proc filter = (proc (int) bool p, list l) list:
if l is nil then nil
elif p(hd(l)) then cons(hd(l), filter(p,tl(l)))
else filter(p, tl(l))
proc sieve = (list l) list:
if l is nil then nil
proc not multiple = (int n) bool: n mod hd(l) ≠ 0;
cons(hd(l), sieve( filter( not multiple, tl(l) )))
proc primes = (int n) list: sieve( tl( one to(n) ));
show( primes(100) )
– All procedures constituting the operating system were written in , although a number of other closely associated protected procedures – such as a paginator – are written in .
- Developed at
was written in .
– The hardware was custom and microprogrammable, with an operating system, (modular) compiler, editor, garbage collector and filing system all written in . The command shell Curt was designed to access typed data similar to Algol-68 modes.
was the implementation language of the
VME. S3 was based on ALGOL 68 but with data types and operators aligned to those offered by the .
Note: The Soviet Era computers
and Эльбрус-2 were created using high-level language Эль-76 (AL-76), rather than the traditional assembly. Эль-76 resembles Algol-68, The main difference is the dynamic binding types in Эль-76 supported at the hardware level. Эль-76 is used for application, job control, system programming.
are written in ALGOL 68, effectively making ALGOL 68 an application of itself. Other applications include:
- a hardware description language and support toolset. Developed by the
during the 1980s and 1990s.
System - "... 400K of error-free
code was produced with three man-years of work. ..."
routines. Supplied in ALGOL 68 during the 1980s.
TORRIX - a programming system for operations on vectors and matrices over arbitrary fields and of variable size by S.G. van der Meulen and M. Veldhorst.
A feature of ALGOL 68, inherited from the
tradition, is its different representations. There is a representation language used to describe algorithms in printed work, a strict language (rigorously defined in the Report) and an official reference language intended to be used in actual compiler input. In the examples you will observe bold typeface words, this is the strict language. ALGOL 68's reserved words are effectively in a different
from identifiers, and spaces are allowed in identifiers, so this next fragment is legal:
int a real int = 3 ;
The programmer who actually writes code does not always have an option of bold typeface or underlining in the code as this may depend on hardware and cultural issues. So different methods to denote these identifiers have been devised. This is called a
regime. For example all or some of the following may be available programming representations:
int a real int = 3; # the strict language #
'INT'A REAL INT = 3; # QUOTE stropping style #
.INT A REAL INT = 3; # POINT stropping style #
INT a real int = 3; # UPPER stropping style #
int a_real_int = 3; # RES stropping style, there are 61 accepted reserved words #
All implementations must recognise at least POINT, UPPER and RES inside PRAGMAT sections. Of these, POINT and UPPER stropping are quite common, while RES stropping is in contradiction to the specification (as there are no reserved words). QUOTE (single apostrophe quoting) was the original recommendation, while matched apostrophe quoting, common in ALGOL 60, is not used much in ALGOL 68.
The following characters were recommended for portability, and termed "worthy characters" in the :
Worthy Characters: ABCDEFGHIJKLMNOPQRSTUVWXYZ "#$%'()*+,-./:;&=&@[ ]_|
This reflected a problem in the 1960s where some hardware didn't support lower-case, nor some other non- characters, indeed in the 1973 report it was written: "Four worthy characters — "|", "_", "[", and "]" — are often coded differently, even at installations which nominally use the same character set."
Base characters: "Worthy characters" are a subset of "base characters".
Algol68 "strict"
as typically published
Quote stropping
character code compiler
character code compiler
? underline or
bold typeface ?
mode xint = int;
xint sum sq:=0;
for i while
sum sq≠70×70
sum sq+:=i↑2
'pr' quote 'pr'
'mode' 'xint' = 'int';
'xint' sum sq:=0;
'for' i 'while'
sum sq≠70×70
sum sq+:=i↑2
.PR UPPER .PR
MODE XINT = INT;
XINT sum sq:=0;
FOR i WHILE
sum sq/=70*70
sum sq+:=i**2
.PR POINT .PR
.MODE .XINT = .INT;
.XINT SUM SQ:=0;
.FOR I .WHILE
SUM SQ .NE 70*70
SUM SQ .PLUSAB I .UP 2
ALGOL 68 allows for every natural language to define its own set of keywords Algol-68. As a result, programmers are able to write programs using keywords from their native language. Below is an example of a simple procedure that calculates "the day following", the code is in two languages: English and German.[]
# Next day date - English variant #
mode date = struct(int day, string month, int year);
proc the day following = (date x) date:
x & length of month (month of x, year of x)
then (day of x + 1, month of x, year of x)
elif month of x = "December"
then (1, "January", year of x + 1)
else (1, successor of month (month of x), year of x)
# Nachfolgetag - Deutsche Variante #
menge datum = tupel(ganz tag, wort monat, ganz jahr);
funktion naechster tag nach = (datum x) datum:
wenn tag von x & monatslaenge(monat von x, jahr von x)
dann (tag von x + 1, monat von x, jahr von x)
wennaber monat von x = "Dezember"
dann (1, "Januar", jahr von x + 1)
ansonsten (1, nachfolgemonat(monat von x), jahr von x)
Russian/Soviet example: In English Algol68's reverent case statement reads case ~ in ~ out ~ esac, in
this reads выб ~ в ~ либо ~ быв.
For its technical intricacies, ALGOL 68 needs a cornucopia of methods to deny the existence of something:
skip, "~" or "?"C - an undefined value always syntactically valid,
empty - the only value admissible to void, needed for selecting void in a union,
void - syntactically like a mode, but not one,
nil or "○" - a name not denoting anything, of an unspecified reference mode,
() or specifically [1:0]int - a vacuum is an empty array (here specifically of mode []int).
undefined - a standards reports procedure raising an exception in the runtime system.
? - Used in the standards report to inhibit
of certain types. e.g. sema
c.f. below for other examples of ?.
The term nil is var always evaluates to true for any variable (but see above for correct use of is :/=:), whereas it is not known to which value a comparison x & skip evaluates for any integer x.
ALGOL 68 leaves intentionally undefined what happens in case of integer overflow, the integer bit representation, and the degree of numerical accuracy for floating point. In contrast, the language
has been criticized for over-specifying the latter.
Both official reports included some advanced features that were not part of the standard language. These were indicated with an ? and considered effectively private. Examples include "≮" and "≯" for templates, the outtype/intype for crude , and the straightout and straightin operators for "straightening" nested arrays and structures.
Extract from the 1973 report:
§10.3.2.2. Transput modes
a) mode ? simplout = union (≮L int≯, ≮L real≯, ≮L compl≯, bool, ≮L bits≯,
char, [ ] char);
b) mode ? outtype = ? an actual - declarer specifying a mode united
from a sufficient set of modes none of which is 'void' or contains 'flexible',
'reference to', 'procedure' or 'union of' ?;
c) mode ? simplin = union (≮ref L int≯, ≮ref L real≯, ≮ref L compl≯, ref bool,
≮ref L bits≯, ref char, ref [ ] char, ref string);
d) mode ? intype = ? ... ?;
§10.3.2.3. Straightening
a) op ? straightout = (outtype x) [ ] simplout: ? the result of "straightening" 'x' ?;
b) op ? straightin = (intype x) [ ] simplin: ? the result of straightening 'x' ?;
- S. H. Valentine - February 1973
1973 – B. R. Alexander and G. E. Hedrick. A Comparison of PL/1 and ALGOL 68. International Symposium on Computers and Chinese Input/Output Systems. pp. 359–368.
1976 – Evaluation of ALGOL 68,
Versus TINMAN - Requirements for a Common High Order Programming Language.
- A Comparison of the Properties of the Programming Languages ALGOL 68, , , , , , ,
in Relation to Real Time Programming - R R K Schenk - Oct 1976
- Executive Summary - Language Evaluation Coordinating Committee - Evaluation of , , ALGOL 68, , , , , , , , , , , , , , , , ,
67, JOVIAL J3B, JOVIAL J73 & .
- June 1977.
- Algol 60, FORTRAN, Pascal and Algol 68.
- , , Algol 68,
- April 1993.
1999 – : Algol68, Pascal and C
in ALGOL 68 and
– Michael Walker – Spring 2000
- How well will Google's
stand up against Brand X programming language? - David Given – November 2009
from "Concepts in Programming Languages - Block-structured procedural languages" – by Dr Marcelo Fiore
Except where noted (with a superscript), the language described above is that of the "Revised Report(r1)".
The original language (As per the "Final Report") differs in syntax of the mode cast, and it had the feature of proceduring, i.e. coercing the value of a term into a procedure which evaluates the term. Proceduring would be intended to make evaluations lazy. The most useful application could have been the short-circuited evaluation of boolean operators. In:
op andf = (bool a,proc bool b)bool:(a | b | false);
op orf = (bool a,proc bool b)bool:(a | true | b);
b is only evaluated if a is true.
As defined in ALGOL 68, it did not work as expected, for example in the code:
if false andf co proc bool: co ( print ("Should not be executed"); true)
against the programmers na?ve expectations the print would be executed as it is only the value of the elaborated enclosed-clause after andf that was procedured. Textual insertion of the commented-out proc bool: makes it work.
Some implementations emulate the expected behaviour for this special case by extension of the language.
Before revision, the programmer could decide to have the arguments of a procedure evaluated serially instead of collaterally by using semicolons instead of commas (s).
For example in:
proc test = (real real b) :...
test (x plus 1, x);
The first argument to test is guaranteed to be evaluated before the second, but in the usual:
proc test = (real a, b) :...
test (x plus 1, x);
then the compiler could evaluate the arguments in whatever order it felt like.
After the revision of the report, some extensions to the language have been proposed to widen the applicability:
partial parametrisation (aka ): creation of functions (with fewer parameters) by specification of some, but not all parameters for a call, e.g. a function logarithm of two parameters, base and argument, could be specialised to natural, binary or decadic log,
module extension: for support of external linkage, two mechanisms were proposed, bottom-up definition modules, a more powerful version of the facilities from
and top-down holes, similar to the ENVIRON and USING clauses from
mode parameters: for implementation of limited parametrical polymorphism (most operations on data structures like lists, trees or other data containers can be specified without touching the pay load).
So far, only partial parametrisation has been implemented, in Algol 68 Genie.
Description
Target CPU
Implementation Language
Scientific
ALGOL for generalised grammars
Draft proposal
First version of Algol 68
Specification
ALGOL 68DR
Draft proposal
IFIP WG 2.1 Draft Report
Specification - March
IFIP WG 2.1 Final Report
Specification - August
Scientific
Portable compiler system
ICL 2900/Series 39, Multics, VMS & C generator (1993)
ALGOL 68RS
Algol 68 with areas
Experimental & other
Addition of areas to Algol 68
Mini ALGOL 68
Portable interpreter
"The importance of implementation models."
Scientific
Cambridge Algol 68
, IBM 360, PDP 10 & Unix, , Tesla & (1980)
ALGOL 68 Revised Report
IFIP WG 2.1 Revised Report
Specification
Experimental & other
Proposed extensions to the mode system of Algol 68
Specification
practical uses
USSR/Poland
Odra 1204/IL
Oklahoma ALGOL 68
programming instruction
implementation
Berlin ALGOL 68
An Abstract ALGOL 68 Machine - machine independent Compiler
Multi-purpose
Revised Report complete implementation with debug features
System/370
lease, Chion Corporation
Scientific
Parallel ALGOL 68-R
Scientific
Scientific
Proposed superlanguage of ALGOL 68
Telecommunications
Full Language + Modules
IBM, DEC, CAMCOH, PS 1001 & PC
Noncommercial
Scientific
Sun version of ALGOL 68
ST (under ),
Algol68toC (ctrans)
Electronics
ctrans from
Portable C generator 
ALGOL 68RS
Noncommercial shareware
Algol 68 GenieG
Full Language
Includes standard collateral clause
Portable interpreter
Algol 68 Genie Version 2.0.0
Full Language
P optional compilation of selected units
that was used to write the
operating system and much other system software on the
was a direct derivative of Algol 68. However, it omitted many of the more complex features, and replaced the basic modes with a set of data types that mapped directly to the 2900 Series hardware architecture.
ALGOL 68R(R) from
was the first ALGOL 68 subset implementation, running on the . Based on the original language, the main subset restrictions were definition before use and no parallel processing. This compiler was popular in
universities in the 1970s, where many
students learnt ALGOL 68 as their first
the compiler was renowned for good error messages.
ALGOL 68RS(RS) from
was a portable compiler system written in ALGOL 68RS (bootstrapped from ALGOL 68R), and implemented on a variety of systems including the /,
and . The language was based on the Revised Report, but with similar subset restrictions to ALGOL 68R. This compiler survives in the form of an Algol68-to-C compiler.
In ALGOL 68S(S) from
the power of parallel processing was improved by adding an orthogonal extension, eventing. Any variable declaration containing keyword event made assignments to this variable eligible for parallel evaluation, i.e. the right hand side was made into a procedure which was moved to one of the processors of the
multiprocessor system. Accesses to such variables were delayed after termination of the assignment.
(C) was a portable compiler that implemented a subset of ALGOL 68, restricting operator definitions and omitting garbage collection, flexible rows and formatted transput.
Algol 68 Genie(G) by M. van der Veer is an ALGOL 68 implementation for today's computers and operating systems.
"Despite good intentions, a programmer may violate portability by inadvertently employing a local extension. To guard against this, each implementation should provide a PORTCHECK pragmat option. While this option is in force, the compiler prints a message for each construct that it recognizes as violating some portability constraint."
... The scheme of type composition adopted by C owes considerable debt to Algol 68, although it did not, perhaps, emerge in a form that Algol's adherents would approve of. The central notion I captured from Algol was a type structure based on atomic types (including structures), composed into arrays, pointers (references), and functions (procedures). Algol 68's concept of unions and casts also had an influence that appeared later.
... C does not descend from Algol 68 is true, yet there was influence, much of it so subtle that it is hard to recover even when I think hard. In particular, the union type (a late addition to C) does owe to A68, not in any details, but in the idea of having such a type at all. More deeply, the type structure in general and even, in some strange way, the declaration syntax (the type-constructor part) was inspired by A68. And yes, of course, "long". , 18 June 1988
"Congratulations, your Master has done it" -
The more I see of it, the more unhappy I become - E.W. Dijkstra, 1968
[...] it was said that A68's popularity was inversely proportional to [...] the distance from Amsterdam -
[...] The best we could do was to send with it a minority report, stating our considered view that, "... as a tool for the reliable creation of sophisticated programs, the language was a failure." [...] -
in his Oct 1980
Their actual minority report quote from 1970: "[...] More than ever it will be required from an adequate programming tool that it assists, by structure, the programmer in the most difficult aspects of his job, viz. in the reliable creation of sophisticated programs. In this respect we fail to see how the language proposed here [Algol68] is a significant step forward: on the contrary, we feel that its implicit view of the programmer's task is very much the same as, say, ten years ago. This forces upon us the conclusion that, regarded as a programming tool, the language must be regarded as obsolete. [...]" Signed by: , , , , , , , . And then on Dec. 23, 1968,
(April 1993).
(PDF) 2007.
Influence on C: types, structures, arrays, pointers and procedures - Dennis Ritchie
(June 1988).
Influence on C: union, structure, syntax and long precision - Dennis Ritchie
(PDF). March 1993. Page 12, 2nd paragraph: Algol68 [gave] operator overloading(§3.3.3), references (§3.3.4), and the ability to declare variables anywhere in a block (§3.3.1) 2008.
. July 1998.
from the original on 1 May .
. Archived from
on August 10, .
. jmvdveer.home.xs4all.nl (). Retrieved on .
(1996). T.J. Bergin & R.G. Gibson, ed. . . also in ACM SIGPLAN Notices 28(3), March 1993 (includes a comprehensive bibliography of the meetings and discussions before, during and after development of ALGOL 68). .  .
. Archived from
. March 1968. Archived from
on September 30, .
(PDF). October .
(PDF). October .
(PDF). December .
. September 1973. Archived from
on September 27, .
Lu Hu-quan (1971).
- Peking, China 2012.
(PDF) (in Russian). . 1988.
(PDF) from the original on 15 November .
(PDF) (in Russian). . .
"IS NOT OPERATOR" -
David Holdsworth (Winter ). . Computer Resurrection - Number 49.
. . Retrieved on .
Oliver, J. R.; Newton, R.S. (1979).
(PDF). The Computer Journal. 22 (2): 114–118. :.
. Softwarepreservation.org. Retrieved on .
Revised Report, page 123, footnote
Lindsey, C.H.; Boom, H.J. (Dec 1978). . ALGOL Bulletin (43). :.
. . Retrieved on .
. Sourceforge.net. Retrieved on .
August 29, 2006, at the .
C.H.A. Koster (1993).
(PDF) 2015.
E.W. Dijkstra. .
from the original on 21 April .
(June 2005).
Hoare, C. A. R. (February 1981) [based on his 1980 ].
(PDF). . 24 (2): 75–83. :. Archived from
. March 1970. Archived from
on September 30, .
Brailsford, D.F. and Walker, A.N., Introductory ALGOL 68 Programming, Ellis Horwood/Wiley, 1979
Lindsey, C.H. and van der Meulen, S.G., Informal Introduction to ALGOL 68, North-Holland, 1971
McGettrick, A.D., ALGOL 68, A First and Second Course, Cambridge Univ. Press, 1978
Peck, J.E.L., An ALGOL 68 Companion, Univ. of British Columbia, October 1971
Tanenbaum, A.S., A Tutorial on ALGOL 68, Computing Surveys 8, 155-190, June 1976 and 9, 255-256, September 1977,
Woodward, P.M. and Bond, S.G., ALGOL 68-R Users Guide, London, Her Majesty's Stationery Office, 1972
The official reference for users and implementors of the language (large pdf file, scanned from Algol Bulletin)
Hyperlinked HTML version of the Revised Report
, by , in Computing Surveys, Vol. 8, No. 2, June 1976, with
(Vol. 9, No. 3, September 1977)
McJones, Paul, , Software Preservation Group, ,
: Hidden categories:}

我要回帖

更多关于 int 最大值 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信