ときどきの雑記帖 RE* (新南口)
Tears in Rain
バビロンプロジェクト
読む前に想像してたのと違った(笑)
jai
- Porting 58k lines of D and C++ to Jai | Hacker News
- Porting 58000 lines of D and C++ to jai, Part 0: Why and How | Yet Another Blog
jaiってなんだろうと思ったら、(現時点では)オープンになっていない プログラミング言語処理系だそうな。
I’m also frustrated at a language in closed beta being perpetually compared to a language that is open source and in production.
Your links back up the statement. The first says the compiler is proprietary and unavailable outside of some beta testers, but may be open in the great and nebulous future.
- Ivo-Balbaert/The_Way_to_Jai: A book to discover and learn the Jai programming language
- Home · Jai-Community/Jai-Community-Library Wiki
メモ
The Evolution of Ruby Strings from 1.8 to 3.2 | by Tech - RubyCademy | RubyCademy | Medium
北斗の拳@tvk
OP変わった。
The Origins of Python
興味深く読んだ。
The programming language used at the London workshop in 1970 was TELCOMP,3 a simple unstructured language similar to BASIC—not BASIC as it is now, but unstructured BASIC as it was then.4 The programming language taught at the Istanbul workshop in 2019 was Python,5 a programming language designed by Guido van Rossum that has become wildly popular,6 steadily gaining in popularity since an inconspicuous public release in 1991. As far apart as these events are, both in time and geography, an arc of history connects them.
このTELCOMPというのはたぶん初めて見た名前だと思うけど
1.01 DO PART 2 FOR I = 1:1:N-1
2.01 DO PART 3 FOR J = 1:1:N-1
3.01 DO PART 4 IF A[J] > A[J+1]
4.01 SET X = A[J]
4.02 SET A[J] = A[J+1]
4.03 SET A[J+1] = X
こんな感じのコードなのだとか。
行頭に番号がつくのはBASICっぽいけど.
がついているのがポイント(BASICと違う点)で、
.
の前の部分が処理の塊(ブロック)を表し、
あとの部分がブロックの中でのシーケンスを表していると。
https://walden-family.com/bbn/bbn-print2.pdf p.81
4.2 Higher-level language work LGP-30 compiler extensions
こんなところにもLGP-30が。
JOSS
このTELCOMP、JOSSの流れを汲むものであったということなので JOSSも見てみるとなるほど共通点が多い(つーか こっちの名前は聞き覚えがあったけどどんなソースコードになるのかは知らなかった)。
Loops and conditions
JOSS uses a suffix notation to indicate conditional evaluation, “do this if this is true”, in contrast to most languages which place the condition in front in prefix notation, “if this is true, do this”. Like BASIC, but unlike FORTRAN or FOCAL, any statement can be conditionally evaluated in this fashion. For example, to print a string only if a condition is met, one can combine the if with a Type:
1.1 Type "Hello, World!" if X=5.
Perlの後置if(if修飾子)ってこれから来たんだろうか?
このほかにも面白い(特徴的な)仕様があって、たとえば
Expressions and propositions
A unique feature of JOSS was its handling of logical expressions. Most computer languages offer some way to form a multi-part mathematical expression, for instance, Set x=(1+2)·3. which sets the variable x to the value 9. JOSS expanded on this concept by clearly defining the concept of the “proposition”, an expression that returns a logical value, true or false, instead of a numeric one. They were mostly seen in If statements, as in the examples above, but the boolean value could also be stored in a variable directly,[33] or one could convert true to 1 and false to 0 using the tv (truth value) function.[34]
In addition to propositions, JOSS also had the concept of “conditional expressions”. These consisted of strings of propositions along with code that would run if that proposition was true. This allowed multi-step decision trees to be written in a single line. They serve a purpose similar to the ternary operator found in modern languages like C or Java, where they are used to return a value from a compact structure implementing if-then-else. JOSS’ version has any number of conditionals, not just three, so it is more of a compact switch statement than a compact if-then.[35]
This example recreates the function of the sgn function:[36]
Let s(x)=[x=0:0; x>0:1; x<0:-1].
JOSSにもletがあったようで、時期的にはBASICより早くて最初期の部類?
Let
Let was used to define user-defined functions.[39] Equivalent to BASIC’s DEF FN.[30]
Let t(x)=sin(x)/cos(x). Set j=t(1.1). Type j.
Let can also be used to set the value of a variable using a formula consisting of a constant:
Let x=5.
Sample program
1.1 Demand p,q. 1.2 Stop if q<0 or r(q,2)=0. 1.3 Set a=1. 1.4 Do part 2 while q>1 and a≠0. 1.5 Type a in form 3. 1.6 Stop. 2.1 Do part 20. 2.1 Do part 11 if p<0. 2.2 Do part 12 if p≥q. 2.3 Do part 13 if p=0. 2.4 Done if a=0. 2.5 Set p=p/4 while r(p,4)=0. 2.6 Do part 14 if r(p,2)=0. 2.7 Do part 20. 2.8 Set a=-a if r(p,4)=r(q,4)=3. 2.9 Set s=p, p=q, q=s. 2.95 Do part 20. 11.1 Set a=-a if r(q,4)=3. 11.2 Set p=|p|. 11.3 Do part 20. 12.1 Set p=r(p,q). 12.2 Do part 20. 13.1 Set a=0, p=1, q=1. 14.1 Set a=-a if r(q,8)=3 or r(q,8)=5. 14.2 Set p=p/2. 20.1 Type p, q in form 1 if a=1. 20.2 Type p, q in form 2 if a=-1. Form 1: " L(%.0f,%.0f) =" Form 2: " -L(%.0f,%.0f) =" Form 3: " %.0f\n"
翻訳
翻訳記事が出ていた>The Origins of Python
GNU C Language Intro and Reference
以前ちょっと触れた GNU C Language Intro and Reference の最終結果に出てこない部分について。
見出し(セクション名)でいうと以下の三つ。
- @section IEEE 754 Decimal Arithmetic
- @section Double-Rounding Problems
- @section More on Decimal Floating-Point Arithmetic
一番目と三番目が十進浮動小数点数 (Decimal floating point - Wikipedia) の話で、二番目はIntelのx87環境で起きる(起きていた) 80ビットから64ビットへの丸目の問題の話。
十進浮動小数点数をサポートしているCPUってPOWERくらいしか知らないのだけど、 他にもあるんだろうか?
FORTRAN Compiler on IBM 704
ソースコードの構文解析では大雑把に ソースを1行読み込む(コメント行の読み飛ばし) → 算術式(ARITHMETIC)かどうかの判定 →(算術式の場合) 式の解析 →(算術式以外の場合) 文(DO、IFなど)の解析
となっているのだけど、
実は(?)
ソース読み込みと算術式かどうかの判定の間に
SCANS FOR HOLLERITH AND ILLEGAL CHARACTERS
というステップがある。
サブルーチンとしてはこんな感じ。
REM CD000/ CALLS=C0190X,C0190,DIAG. 4F11681
REM CD000 SCANS FOR HOLLERITH AND ILLEGAL CHARACTERS. 4F11682
CD000 TSX C0190X,4 * SET SCAN TO PICK UP 1ST CHARACTER. 4F11683
CD001 TSX CD900,1 * IF NOT ENDMARK OR ILLEGAL CHARACTER4F11684
CAS COMMA SCAN 4F11685
TXI CD002,0 FOR 4F11686
TXI CD003,0 HOLLERITH 4F11687
CD002 SUB OPEN SPECIFICATION 4F11688
TNZ CD001 WHICH 4F11689
CD003 TSX CD900,1 * CAN BE= 4F11690
SUB L(10) , N H 4F11691
TPL CD001 OR = ( N H. 4F11692
CD004 TSX CD900,1 * IF NOT ENDMARK OR ILLEGAL CHARACTER4F11693
CAS L(9) CONTINUE SCAN. 4F11694
TXI CD005,0 N 4F11695
TXI CD004,0 IS 4F11696
TXI CD004,0 A 4F11697
CD005 CAS L(H) FIXED 4F11698
TXI CD001+1,0 POINT 4F11699
TXI CD700,0 INTEGER. 4F11700
TXI CD001+1,0 X 4F11701
CD700 TSX C0190,4 * GO GET NEXT NONBLANK CHARACTER, 4F11702
CAS ENDMK AND IF ENDMARK, 4F11703
TXI CD701,0 THEN SKIP 4F11704
TXI CC000,0 * TO NON-ARITHMETIC CLASSIFICATION. 4F11705
CD701 TSX CD600,1 * SINCE HOLLERITH HAS BEEN FOUND, 4F11706
TXI CD700,0 THEN $ IS LEGAL IN FORMAT TEST. 4F11707
CD900 TSX C0190,4 * OBTAIN NEXT NONBLANK CHARACTER, 4F11708
CAS ENDMK AND IF NOT 4F11709
TXI CD800,0 ENDMARK, THEN SKIP 4F11710
TXI CB000,0 * EXIT TO ARITH/NON-ARITH SCAN. 4F11711
CD800 CAS SPECOP CHECK FOR $ 4F11712
TXI CD601,0 WHICH, UNLESS HOLERITH, IS AN 4F11713
TSX DIAG,4 * ERROR -- GO TO DIAGNOSTIC. 4F11714
CD600 CAS PM CHECK FOR RECORD MARK 4F11715
TRA 1,1 WHICH IS AN 4F11716
TSX DIAG,4 * ERROR -- GO TO DIAGNOSTIC. 4F11717
CD601 CAS CHAR3 CHECK FOR MINUS ZERO 4F11718
TRA 1,1 WHICH IS AN 4F11719
TSX DIAG,4 * ERROR -- GO TO DIAGNOSTIC. 4F11720
CAS CHAR2 CHECK FOR PLUS ZERO 4F11721
TRA 1,1 WHICH IS AN 4F11722
TSX DIAG,4 * ERROR -- GO TO DIAGNOSTIC. 4F11723
CAS MINUS CHECK FOR MINUS SIGN 4F11724
TRA 1,1 WHICH IS AN 4F11725
TSX DIAG,4 * ERROR -- GO TO DIAGNOSTIC. 4F11726
SUB TEN CHECK FOR TEN 4F11727
TNZ 1,1 WHICH IS AN 4F11728
TSX DIAG,4 * ERROR -- GO TO DIAGNOSTIC. 4F11729
REM END OF PROGRAM CD000. 4F11730
流れとしてはだいたい把握できている(と思っている)のだけど、
数字のならび→H
→ENDMK
という並びだったときに
TO NON-ARITHMETIC CLASSIFICATION
となるのがなぜなのかよくわからん
(通常はEXIT TO ARITH/NON-ARITH SCAN
)。