User talk:Mbishop: Difference between revisions

From Rosetta Code
Content added Content deleted
m (→‎Algol language file: use html entities for algol characters)
Line 12: Line 12:


Actually it isn't to bad. There are several types of identifiers.
Actually it isn't to bad. There are several types of identifiers.
* BOLD - IF/THEN/ELSE/FI, CASE/IN/OUT/ESAC, FOR/Rev0OM/BY/TO/DO/OD, MODEs and OPerators. Normally <b>bolded</b>.
* BOLD - IF/THEN/ELSE/FI, CASE/IN/OUT/ESAC, FOR/FROM/BY/TO/DO/OD, MODEs and OPerators. Normally <b>bolded</b>.
* OPerators - can be special characters, see below.
* OPerators - can be special characters, see below.
* names - alphanumeric starting with alphabetic, spaces in the middle are ignored. Normally <i>italiced</i>.
* names - alphanumeric starting with alphabetic, spaces in the middle are ignored. Normally <i>italiced</i>.
Line 20: Line 20:
There are 4 different main contexts.
There are 4 different main contexts.
* Code - BEGIN ~ END or ( ~ )
* Code - BEGIN ~ END or ( ~ )
* A COmment - either CO ~ CO or COMMENT ~ COMMENT or ¢ ~ ¢ (two cents worth)
* A COmment - either CO ~ CO or COMMENT ~ COMMENT or &cent; ~ &cent; (two cents worth)
* A PRagmat - either PR ~ PR or PRAGMAT ~ PRAGMAT.
* A PRagmat - either PR ~ PR or PRAGMAT ~ PRAGMAT.
* STRINGs - "double quotes", where """" is a strings containing 1 double quote.
* STRINGs - "double quotes", where """" is a strings containing 1 double quote.
Line 34: Line 34:
You will have fun with these:
You will have fun with these:


The , , ¬, , , , &times;, ÷, ⌷, , , ⌊, ⌈ and characters can be found on the [[:wikipedia:IBM 2741]] keyboard with the [[:wikipedia:APL programming language#APL symbols and keyboard layout|APL]] "golf-ball" print head inserted, these became available in the mid 1960s while ALGOL 68 was being drafted.
The &or;, &and;, &not;, &ne;, &le;, &ge;, &times;, &divide;, ⌷, &uarr;, &darr;, ⌊, ⌈ and &perp; characters can be found on the [[:wikipedia:IBM 2741]] keyboard with the [[:wikipedia:APL programming language#APL symbols and keyboard layout|APL]] "golf-ball" print head inserted, these became available in the mid 1960s while ALGOL 68 was being drafted.


Note that Unicode character "DECIMAL EXPONENT SYMBOL 23e8" is also permitted. eg In Algol "1 million" can be 1 000 000 or 1e6 or even 1⏨6.
Note that Unicode character "DECIMAL EXPONENT SYMBOL 23e8" is also permitted. eg In Algol "1 million" can be 1 000 000 or 1e6 or even 1⏨6.
Line 49: Line 49:
'''channel''', '''file''', '''format''', '''struct''', '''union''',
'''channel''', '''file''', '''format''', '''struct''', '''union''',
Misc Syntax†:
Misc Syntax†:
'''of''', '''at''' "@", '''is''' ":=:", '''isnt''' "::",
'''of''', '''at''' "@", '''is''' ":=:", '''isnt''' ":&ne;:",
Builtin "constants"†:
Builtin "constants"†:
'''true''', '''false''', '''empty''', '''nil''' "°", '''skip''' "~" (also "?"),
'''true''', '''false''', '''empty''', '''nil''' "&deg", '''skip''' "~" (also "?"),
Comments and Pragmats†:
Comments and Pragmats†:
'''co''' "¢", '''comment''' "¢", '''pr''', '''pragmat''',
'''co''' "&cent;", '''comment''' "&cent;", '''pr''', '''pragmat''',
Flow control†:
Flow control†:
'''case''' '''in''' '''ouse''' '''''in''''' '''out''' '''esac''' "( ~ | ~ |: ~ | ~ | ~ )",
'''case''' '''in''' '''ouse''' '''''in''''' '''out''' '''esac''' "( ~ | ~ |: ~ | ~ | ~ )",
Line 75: Line 75:
|ALIGN=CENTER| 10 || '''not''', '''up''', '''down''', '''lwb''', '''upb''',
|ALIGN=CENTER| 10 || '''not''', '''up''', '''down''', '''lwb''', '''upb''',
-, '''abs''', '''arg''', '''bin''', '''entier''', '''leng''', '''level''', '''odd''', '''repr''', '''round''', '''shorten'''
-, '''abs''', '''arg''', '''bin''', '''entier''', '''leng''', '''level''', '''odd''', '''repr''', '''round''', '''shorten'''
| ¬, , , ⌊, ⌈
| &not;, &uarr;, &darr;, ⌊, ⌈
| ~
| ~
| ╰, ╭
| ╰, ╭
Line 88: Line 88:
!bgcolor=#cccccc|+Algol68<sup>Rev0</sup>
!bgcolor=#cccccc|+Algol68<sup>Rev0</sup>
|-
|-
|ALIGN=CENTER|9||+*, '''i'''||+&times;, || ||
|ALIGN=CENTER|9||+*, '''i'''||+&times;, &perp;|| ||
|-
|-
|ALIGN=CENTER|8|| '''shl''', '''shr''', **, '''up''', '''down''', '''lwb''', '''upb''' || , , ⌊, ⌈ || || ╰, ╭
|ALIGN=CENTER|8|| '''shl''', '''shr''', **, '''up''', '''down''', '''lwb''', '''upb''' || &uarr;, &darr;, ⌊, ⌈ || || ╰, ╭
|-
|-
|ALIGN=CENTER|7|| *, /, %, '''over''', %*, '''mod''', '''elem'''|| &times;, ÷, ÷&times;, ÷*, %&times;, ⌷ || || ÷:
|ALIGN=CENTER|7|| *, /, %, '''over''', %*, '''mod''', '''elem'''|| &times;, &divide;, &divide;&times;, &divide;*, %&times;, ⌷ || || &divide;:
|-
|-
|ALIGN=CENTER|6||-, + || || ||
|ALIGN=CENTER|6||-, + || || ||
|-
|-
|ALIGN=CENTER|5||<, '''lt''', <=, '''le''', >=, '''ge''', >, '''gt'''|| , ||
|ALIGN=CENTER|5||<, '''lt''', <=, '''le''', >=, '''ge''', >, '''gt'''|| &le;, &ge; ||
|-
|-
|ALIGN=CENTER|4||=, '''eq''', /=, '''ne''' || || ~= ||
|ALIGN=CENTER|4||=, '''eq''', /=, '''ne''' || &ne; || ~= ||
|-
|-
|ALIGN=CENTER|3||&, '''and'''||, /\||
|ALIGN=CENTER|3||&, '''and'''||&and;, /\||
|-
|-
|ALIGN=CENTER|2||'''or'''||, \/ ||
|ALIGN=CENTER|2||'''or'''||&or;, \/ ||
|-
|-
|ALIGN=CENTER|1||'''minusab''', '''plusab''', '''timesab''', '''divab''', '''overab''', '''modab''', '''plusto''',
|ALIGN=CENTER|1||'''minusab''', '''plusab''', '''timesab''', '''divab''', '''overab''', '''modab''', '''plusto''',
-:=, +:=, *:=, /:=, %:=, %*:=, +=:
-:=, +:=, *:=, /:=, %:=, %*:=, +=:
|| &times;:=, ÷:=, ÷&times;:=, ÷*:=, %&times;:=|| || ÷::=
|| &times;:=, &divide;:=, &divide;&times;:=, &divide;*:=, %&times;:=|| || &divide;::=
|}
|}


Line 118: Line 118:
!bgcolor=#cccccc|+Algol68<sup>Rev0</sup>
!bgcolor=#cccccc|+Algol68<sup>Rev0</sup>
|-
|-
|ALIGN=CENTER| effectively 0 || :=, =:, = , :=:, :/=:, '''is''', '''isnt''', '''of''', '''at'''|| ::, : || :~=: || '''ct''', ::, '''ctab''', ::=, .., '''is not''', , @
|ALIGN=CENTER| effectively 0 || :=, =:, = , :=:, :/=:, '''is''', '''isnt''', '''of''', '''at'''|| :&ne;:, : || :~=: || '''ct''', ::, '''ctab''', ::=, .., '''is not''', &rarr;, @
|}
|}


In conclusion: in 1969 ASCII was mandated in the US, hence many of the
In conclusion: in 1969 ASCII was mandated in the US, hence many of the
characters above are unfamiliar to PC users. Including - surprisingly -
characters above are unfamiliar to PC users. Including - surprisingly -
the character for 1 US cent, eg 1¢
the character for 1 US cent, eg 1&cent;


note: I pulled most of the above from http://en.wikipedia.org/wiki/ALGOL_68
note: I pulled most of the above from http://en.wikipedia.org/wiki/ALGOL_68

Revision as of 20:58, 29 September 2009

Thanks for helping me out with the blog Martin. Maybe I'll just be on milestone and huge activity watch for a while (I've been checking on the statistics page every once in a while looking for something cool like 400 useful pages). When I'm done at my co-op maybe I'll be able to spend my Saturdays figuring out the IRC logging bot or MediaWiki bot. --Mwn3d 21:14, 9 January 2009 (UTC)

No problem, I current don't have a job, so I've got plenty of time, and it's pretty fun. Also one of the best parts of contributing (at least for me) was seeing my name on the blog :D --Mbishop 22:06, 9 January 2009 (UTC)

Omit from placement

In response to your edit comment from a while ago, I think it's become normal to put the omits on the bottom of the page. It really doesn't matter where they go (I don't foresee any content being added to the template), so I guess going with the crowd will be fine for this. --Mwn3d 19:49, 24 September 2009 (UTC)

Algol language file

re: http://rosettacode.org/mw/index.php?title=User_talk%3ANevilleDNZ&diff=64759&oldid=22179

Actually it isn't to bad. There are several types of identifiers.

  • BOLD - IF/THEN/ELSE/FI, CASE/IN/OUT/ESAC, FOR/FROM/BY/TO/DO/OD, MODEs and OPerators. Normally bolded.
  • OPerators - can be special characters, see below.
  • names - alphanumeric starting with alphabetic, spaces in the middle are ignored. Normally italiced.
    • library names - eg sin/cos/tan/open/close etc - I can dig out a complete list...
    • Extension library names - Algol68 has additional OPerators, constants and PROCedures that I can generate a list if you like.

There are 4 different main contexts.

  • Code - BEGIN ~ END or ( ~ )
  • A COmment - either CO ~ CO or COMMENT ~ COMMENT or ¢ ~ ¢ (two cents worth)
  • A PRagmat - either PR ~ PR or PRAGMAT ~ PRAGMAT.
  • STRINGs - "double quotes", where """" is a strings containing 1 double quote.
  • FORMATs - $ddd,g(2),l$, the tricky one is that $f(code)d$, where f(code) is indeed contains Algol68 code returning an INT.

If you want to make things really interesting, Algol68 was internationalised in 1968. Hence it supports other character sets, including Cyrillic: eg

(The Official report is also available in several other languages, including Braille because Algol68 was a UN/UNESCO sponsored language!!)

Special characters for operators

You will have fun with these:

The ∨, ∧, ¬, ≠, ≤, ≥, ×, ÷, ⌷, ↑, ↓, ⌊, ⌈ and ⊥ characters can be found on the wikipedia:IBM 2741 keyboard with the APL "golf-ball" print head inserted, these became available in the mid 1960s while ALGOL 68 was being drafted.

Note that Unicode character "DECIMAL EXPONENT SYMBOL 23e8" is also permitted. eg In Algol "1 million" can be 1 000 000 or 1e6 or even 1⏨6.

BOLD symbols and reserved words as typically printed

There are 61 such reserved words ( some with "brief symbol" equivalents ) in the standard sub-language: Declaration sections†:

mode, op, prio, proc,

Modes modifiers†:

flex, heap, loc, long, ref, short,

Builtin modes†:

bits, bool, bytes, char, compl, int, real, sema, string, void,

Mode compositions†:

channel, file, format, struct, union, 

Misc Syntax†:

of, at "@", is ":=:", isnt ":≠:", 

Builtin "constants"†:

true, false, empty, nil "&deg", skip "~" (also "?"),

Comments and Pragmats†:

co "¢", comment "¢", pr, pragmat,

Flow control†:

case in ouse in out esac "( ~ | ~ |: ~ | ~ | ~ )", 
for from to by while do od,
if then elif then else fi "( ~ | ~ |: ~ | ~ | ~ )", (Rev0 had elsf)
par begin exit "." end "( ~ )", go to, goto, .

Note that these are normally printed in bold.

{† Apologies to C.H. Lindsey et al. for these descriptions, they are not the official ALGOL 68 naming conventions, rather C hybrids.}

Monadic operators

priority Algol68 "Worthy characters" +Algol68Rev1 +Algol68C,G +Algol68Rev0
10 not, up, down, lwb, upb,

-, abs, arg, bin, entier, leng, level, odd, repr, round, shorten

¬, ↑, ↓, ⌊, ⌈ ~ ╰, ╭

Standard dyadic operators with associated priorities

priority Algol68 "Worthy characters" +Algol68Rev0&Rev1 +Algol68C,G +Algol68Rev0
9 +*, i +×, ⊥
8 shl, shr, **, up, down, lwb, upb ↑, ↓, ⌊, ⌈ ╰, ╭
7 *, /,  %, over,  %*, mod, elem ×, ÷, ÷×, ÷*, %×, ⌷ ÷:
6 -, +
5 <, lt, <=, le, >=, ge, >, gt ≤, ≥
4 =, eq, /=, ne ~=
3 &, and ∧, /\
2 or ∨, \/
1 minusab, plusab, timesab, divab, overab, modab, plusto,

-:=, +:=, *:=, /:=, %:=, %*:=, +=:

×:=, ÷:=, ÷×:=, ÷*:=,  %×:= ÷::=

Assignation and identity relations etc

These are technically not operators, rather they are considered "units associated with names"

priority Algol68 "Worthy characters" +Algol68Rev1 +Algol68C +Algol68Rev0
effectively 0 :=, =:, = , :=:, :/=:, is, isnt, of, at :≠:, : :~=: ct, ::, ctab, ::=, .., is not, →, @

In conclusion: in 1969 ASCII was mandated in the US, hence many of the characters above are unfamiliar to PC users. Including - surprisingly - the character for 1 US cent, eg 1¢

note: I pulled most of the above from http://en.wikipedia.org/wiki/ALGOL_68

NevilleDNZ 13:11, 29 September 2009 (UTC)