diff --git a/Conf/.lang.yaml.swp b/Conf/.lang.yaml.swp new file mode 100644 index 0000000000..f7e01d8726 Binary files /dev/null and b/Conf/.lang.yaml.swp differ diff --git a/Conf/lang.yaml b/Conf/lang.yaml index f0c51e51a0..b29f15aed6 100644 --- a/Conf/lang.yaml +++ b/Conf/lang.yaml @@ -1,13 +1,67 @@ 0815: 360 Assembly: 4D: +4DOS Batch: +6502 Assembly: +6800 Assembly: +8 1/2: +80386 Assembly: +8080 Assembly: +8086 Assembly: A+: ABAP: ACL2: ActionScript: ext: as Ada: +Agda: +Agda2: +Agena: +Aikido: +Aime: +Algae: +ALGOL: + ext: alg +ALGOL 60: + ext: alg +ALGOL 68: + ext: alg +ALGOL W: + ext: alg +Alice ML: +Alore: +AmbientTalk: + ext: ambient +AmigaE: + ext: amiga +AMPL: +ANT: +ANTLR: +APL: +AppleScript: +Applesoft BASIC: + ext: bas +Application Master: + ext: +Arbre: +Argile: +ARM Assembly: +ASP: +ASP.Net: + ext: asp +AspectC++: + ext: acpp +AspectJ: +Assembly: + ext: .as +Asymptote: +ATS: +AutoHotkey: + ext: ahk +AutoIt: AWK: +Axiom: +Axum: B: Babel: ext: pb diff --git a/Lang/4DOS-Batch/0DESCRIPTION b/Lang/4DOS-Batch/0DESCRIPTION new file mode 100644 index 0000000000..c07d0681c3 --- /dev/null +++ b/Lang/4DOS-Batch/0DESCRIPTION @@ -0,0 +1,10 @@ +{{stub|exec=no|gc=no|parampass=no|safety=no|strength=no|compat=no|express=no|checking=no|untyped=no|tags=no|LCT=no}} +{{language +|site=http://www.jpsoft.com/ +}} + +'''4DOS''' is a command line interpreter by [http://jpsoft.com/ JP Software], designed to replace the default command interpreter in [[DOS]] and [[Windows]]. '''Take Command''' is a [[GUI]] version for Windows (which includes '''Take Command Console''', formerly called '''4NT'''), and '''4OS2''' is an [[OS/2]] version. + +== See Also == +* [[wp:4DOS|4DOS on Wikipedia]] +* [[wp:Take Command (command line interpreter)|Take Command on Wikipedia]] \ No newline at end of file diff --git a/Lang/6502-Assembly/0DESCRIPTION b/Lang/6502-Assembly/0DESCRIPTION new file mode 100644 index 0000000000..9bcc9b29cf --- /dev/null +++ b/Lang/6502-Assembly/0DESCRIPTION @@ -0,0 +1,18 @@ +[[Category:Assembly]] +{{stub}} +{{language|6502 Assembly +|site=http://www.6502.org/ +}}{{assembler language}} + +The MOS Technology 6502 is an 8-bit microprocessor that was designed by Chuck Peddle and Bill Mensch for MOS Technology in 1975. When it was introduced, it was the least expensive full-featured microprocessor on the market by a considerable margin, costing less than one-sixth the price of competing designs from larger companies such as Motorola and Intel. It was nevertheless fully comparable with them, and, along with the Zilog Z80, sparked a series of computer projects that would eventually result in the home computer revolution of the 1980s. The 6502 design, with about 4,000 transistors, was originally second-sourced by Rockwell and Synertek and later licensed to a number of companies. It is still made for embedded systems. + +One of the first "public" uses for the design was the Apple I computer, introduced in 1976. The 6502 was next used in the Commodore PET and the Apple II. It was later used in the Atari home computers, the BBC Micro family, the Commodore VIC-20 and a large number of other designs both for home computers and business, such as Ohio Scientific and Oric. + + +==Citations== +#[[wp:MOS_Technology_6502|Wikipedia: MOS Technology 6502]] + +==See Also== +*[http://en.wikibooks.org/wiki/6502_Assembly 6502 Assembly From Wikibooks] +*[http://www.6502asm.com/ 6502 compatible assembler and emulator in javascript] +*[http://e-tradition.net/bytes/6502/ 6502 assembler and debugger in JavaScript] \ No newline at end of file diff --git a/Lang/6502-Assembly/99-Bottles-of-Beer b/Lang/6502-Assembly/99-Bottles-of-Beer new file mode 120000 index 0000000000..84b3c4532d --- /dev/null +++ b/Lang/6502-Assembly/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/6502-Assembly \ No newline at end of file diff --git a/Lang/6502-Assembly/Comments b/Lang/6502-Assembly/Comments new file mode 120000 index 0000000000..e1f30d4016 --- /dev/null +++ b/Lang/6502-Assembly/Comments @@ -0,0 +1 @@ +../../Task/Comments/6502-Assembly \ No newline at end of file diff --git a/Lang/6502-Assembly/FizzBuzz b/Lang/6502-Assembly/FizzBuzz new file mode 120000 index 0000000000..18a406b701 --- /dev/null +++ b/Lang/6502-Assembly/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/6502-Assembly \ No newline at end of file diff --git a/Lang/6502-Assembly/Forest-fire b/Lang/6502-Assembly/Forest-fire new file mode 120000 index 0000000000..88eddee718 --- /dev/null +++ b/Lang/6502-Assembly/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/6502-Assembly \ No newline at end of file diff --git a/Lang/6800-Assembly/0DESCRIPTION b/Lang/6800-Assembly/0DESCRIPTION new file mode 100644 index 0000000000..a9d3a95002 --- /dev/null +++ b/Lang/6800-Assembly/0DESCRIPTION @@ -0,0 +1,11 @@ +{{language}}{{assembler language}} +The 6800 was the central processing unit of a family of integrated circuits and development boards designed by Motorola in the early 1970s, and marketed heavily beginning in 1975. Like its contemporary, the Intel 8080, it was a microprocessor with an 8-bit data bus and a 16-bit address bus, offered in a 40-pin DIP. + +It has been stated that the design team loosely based the assembly language of the 6800 on the DEC PDP-11, although cost concerns necessitated that it be a subset of the much larger and more expensive DEC design. + +From a programmer's standpoint, the 6800 possessed two 8-bit accumulators (A and B), two 16-bit pointer registers (X and S), a 16-bit instruction pointer, and an 8-bit flag register (P). Although the 8080 had more registers and a faster base clock, real-world performance and machine-code density were quite similar, due to the more flexible addressing modes and lower clock-per-instruction ratio of the 6800. PC-relative branching instructions (with signed 8-bit displacements) and 8-bit (direct-page) addressing options also helped the 6800 in this regard. The hobbyists of the day had a tendency to fall into two different groups (the 8xxx and 6xxx 'camps'), and countless contests and debates ensued, with each group claiming that their 'family' was superior. It was quite rare to see a small-computer enthusiast in the late 1970s who didn't have a strong preference for one over the other. + +The 6800 spawned many offshoots and offspring, like the MOS Technology 65xx family, the "upward-compatible" Motorola 6809, and numerous micro-controllers. 68xx-based systems were prevalent in the late 1970s and early 1980s, in household, business, and automotive applications. The 6800's popularity in home computers, however, was easily eclipsed by the 65xx family of microprocessors, largely due to the lower hardware cost and comparable performance of the 65xx family. The 8080 suffered a similar fate, at the hands of the Zilog Z-80 (due mostly to the Z-80's richer and more versatile instruction set). + +The Motorola 68000, designed in the late 1970s, was the popular and much more capable successor to the 6800, and although their assembly languages both share a similarity to the DEC PDP-11 (a model of elegance and orthogonality), they are all mutually incompatible. +{{stub}} \ No newline at end of file diff --git a/Lang/6800-Assembly/99-Bottles-of-Beer b/Lang/6800-Assembly/99-Bottles-of-Beer new file mode 120000 index 0000000000..3bcad38294 --- /dev/null +++ b/Lang/6800-Assembly/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/6800-Assembly \ No newline at end of file diff --git a/Lang/8-1-2/0DESCRIPTION b/Lang/8-1-2/0DESCRIPTION new file mode 100644 index 0000000000..b2a1e3df19 --- /dev/null +++ b/Lang/8-1-2/0DESCRIPTION @@ -0,0 +1,15 @@ +{{stub|exec=no|gc=no|parampass=no|safety=no|strength=no|compat=no|express=no|checking=no|untyped=no|tags=no|LCT=no}} +{{language +|site=http://www.spatial-computing.org/~giavitto/HomePageOtto/ +}} + +8 1/2, pronounced otto e mezzo, is a high-level data-parallel language based on a new data structure: the fabric (initially called web). This fundamental data structure represents a field over a (discrete) piece of space-time. It is used in the simulation of dynamical systems. A fabric unify the concept of stream and collection and can be viewed either as a ``stream of collections'' or as a ``collection of streams''. The name come from the title of a Fellini movie. + +The main features of the 8 1/2 programming language are: + +* 8 1/2 is a declarative language, i.e. a programme is a set of definitions (functional equations) specifying fabrics. +* The 8 1/2 streams are sequential, synchronous, memory-bounded streams. +* 8 1/2 collections are handled as a whole. +* 8 1/2 programmes are hierachized through the concept of system. +* The 8 1/2 language is naturally a data flow, data parallel language. +* A static 8 1/2 programme (i.e. a programme involving only fabric with static shape) is detected by the interpreter and can be compiled (in sequential C or towards a SIMD abstract machine). \ No newline at end of file diff --git a/Lang/80386-Assembly/0DESCRIPTION b/Lang/80386-Assembly/0DESCRIPTION new file mode 100644 index 0000000000..95309450b0 --- /dev/null +++ b/Lang/80386-Assembly/0DESCRIPTION @@ -0,0 +1 @@ +{{language}}{{assembler language}}{{stub}} \ No newline at end of file diff --git a/Lang/8080-Assembly/0DESCRIPTION b/Lang/8080-Assembly/0DESCRIPTION new file mode 100644 index 0000000000..a1cc364046 --- /dev/null +++ b/Lang/8080-Assembly/0DESCRIPTION @@ -0,0 +1 @@ +{{language}}{{Stub}}{{assembler language}}[[Category:Assembly]] \ No newline at end of file diff --git a/Lang/8086-Assembly/0DESCRIPTION b/Lang/8086-Assembly/0DESCRIPTION new file mode 100644 index 0000000000..16e1928b2b --- /dev/null +++ b/Lang/8086-Assembly/0DESCRIPTION @@ -0,0 +1 @@ +{{Stub}}{{language}}{{assembler language}}[[Category:Assembly]]8086 Assembly is the assembly language used by the Intel 8086 processor. This processor was used for the first time in the IBM PC, and in its various clones. The 8086 gave birth, starting with the 80186 processor, to the X86 family, that nowadays is the most used processor family in desktop computers. All the 32 and 64 bit processors from this family are able to operate in a 8086 compatibility mode, for backward compatibility with legacy software and running very low-level code (like the BIOS). For the evolution of this assembly implementation to 32 bits, see [[X86 assembly]]. \ No newline at end of file diff --git a/Lang/8086-Assembly/Comments b/Lang/8086-Assembly/Comments new file mode 120000 index 0000000000..78f2bc17cf --- /dev/null +++ b/Lang/8086-Assembly/Comments @@ -0,0 +1 @@ +../../Task/Comments/8086-Assembly \ No newline at end of file diff --git a/Lang/8086-Assembly/FizzBuzz b/Lang/8086-Assembly/FizzBuzz new file mode 120000 index 0000000000..38c9a8868b --- /dev/null +++ b/Lang/8086-Assembly/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/8086-Assembly \ No newline at end of file diff --git a/Lang/ALGOL-60/0DESCRIPTION b/Lang/ALGOL-60/0DESCRIPTION new file mode 100644 index 0000000000..e246651bcd --- /dev/null +++ b/Lang/ALGOL-60/0DESCRIPTION @@ -0,0 +1,4 @@ +{{stub}}{{language|bnf=http://www.masswerk.at/algol60/syntax.txt}} +==See also== +*[[wp:ALGOL|ALGOL 60 on Wikipedia]] +*[[ALGOL 68]] \ No newline at end of file diff --git a/Lang/ALGOL-68/0DESCRIPTION b/Lang/ALGOL-68/0DESCRIPTION new file mode 100644 index 0000000000..0a9c8a8e1b --- /dev/null +++ b/Lang/ALGOL-68/0DESCRIPTION @@ -0,0 +1,165 @@ +[[File:Algol68.png|64px|left|alt=Language|link=http://sourceforge.net/projects/algol68]] +{{language|ALGOL 68 +|parampass=both +|strength=soft, weak, meek, firm and strong - depending on context. +|safety=safe +|express=explicit +|compat=structural +|checking=both +|LCT=yes}} +ALGOL 68 (short for ALGOrithmic Language 1968) is an [[imperative programming|imperative]] computer programming language that was conceived as a successor to the ALGOL 60 programming language, designed with the goal of a much wider scope of application and more rigorously defined syntax and semantics. + +The main aims and principles of design of ALGOL 68: +#Completeness and clarity of design, +#Orthogonal design, +#Security, +#Efficiency: +#* Static mode checking, +#* Mode-independent parsing, +#* Independent compilation, +#* Loop optimization, +#* Representations - in minimal & larger character sets. + +==Execute an ALGOL 68 program online== +* http://www.compileonline.com/execute_algol_online.php +==Grammar== +The grammar for ALGOL 68 is officially in the two level, [[wp:Van Wijngaarden grammar|Van Wijngaarden grammar]] but a subset has been done in the one level [[wp:Backus–Naur Form|Backus–Naur Form]]: +* [[wp:Van Wijngaarden grammar|Van Wijngaarden grammar]]: [http://www.fh-jena.de/~kleine/history/languages/Algol68-ReportAttachement.pdf] +* [[wp:Backus–Naur Form|Backus–Naur Form]]/[[wp:Yacc|Yacc]]: [http://wwwmathlabo.univ-poitiers.fr/~maavl/algol68/syntax68] +* [http://www.softwarepreservation.org/projects/ALGOL/book/Lindsey_van_der_Meulen-IItA68-Revised-SyntaxOnly.pdf/view Syntax Chart (Size 516.6 kB - File type application/pdf)] + +==Resources== +* ALGOL BULLETIN - March 1959 to August 1988, in 52 issues[http://archive.computerhistory.org/resources/text/algol/algol_bulletin/] +* Algol68 mailinglist - December 2008 - algol68-user AT lists.sourceforge.net[https://lists.sourceforge.net/lists/listinfo/algol68-user] + +FYI: There are two online manual pages: +* [https://sourceforge.net/projects/algol68/files/algol68g/algol68g-1.18.0/a68g-doc.pdf/download Algol 68G Manual - By Marcel van der Veer] +* [http://www.poenikatu.co.uk/algol68/ Programming Algol 68 Made Easy - Sian Mountbatten] + +Or - if you prefer a hardcopy - you can try and pick up a hard cover manual like "''Informal Introduction to Algol 68''" - by C. H. Lindsey & S. V. Vander Meulen. Be sure to get the 1977 edition: +* [http://www.amazon.com/gp/offer-listing/0720405041/ref=dp_olp_used?ie=UTF8&condition=used www.amazon.com] - Aboout $119 +* [http://search.barnesandnoble.com/Informal-Introduction-to-ALGOL-68/C-H-Lindsey/e/9780720407266/?itm=3&USRI=Informal+Introduction+to+Algol+68 barnesandnoble.com] - about $40 +IItA68 is a beautiful book, and makes great "bedtime" reading... Highly recommended! + +Editor modes: +* [http://www.jemarch.net/a68-mode Emacs mode] for Algol 68 supporting syntax highlighting and context-sensitive indentation. +* [http://www.vim.org/scripts/script.php?script_id=1927 Vim script] providing support for syntax colouring. + +==Status== +* 20th December 1968 - '''ALGOL 68's''' Final Report was ratified by [http://en.wikipedia.org/wiki/UNESCO UNESCO's] [http://en.wikipedia.org/wiki/IFIP IFIP] working group 2.1 in Munich. +* 20th December 2008 - [[Zig_Zag#ALGOL 68|Zig Zag]] - the 100th '''ALGOL 68''' code contribution on rosettacode.org! +** Happy 40th Birthday '''ALGOL 68''', +** AND 50th Birthday '''ALGOL 58'''. +* 23rd August 2009 - [http://sourceforge.net/projects/algol68/files/ algol68g-1.18.0-9h] released +* 20th December 2009 - Happy 51st/41st Birthdays with [[Hamming_numbers#ALGOL_68|Hamming numbers]] - the 200th '''ALGOL 68''' code contribution on rosettacode.org! +** This time code was by [[User:Algol68g|Marcel van der Veer]], author of [http://www.xs4all.nl/~jmvdveer/algol.html Algol 68 Genie] +* 25th October 2011 - [[User:Jejones3141|Jejones3141]] added [[Soundex#ALGOL_68|Soundex]] - the 300th '''ALGOL 68''' code specimen. + +== Revisions == +*Mar. 1968: Draft Report on the Algorithmic Language ALGOL 68 - Edited by: A. van Wijngaarden, B.J. Mailloux, J.E.L. Peck and C.H.A. Koster. +*Oct. 1968: Penultimate Draft Report on the Algorithmic Language ALGOL 68 - Chapters 1-9 - 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. +*Sep 1973: Revised Report on the Algorithmic Language Algol 68 - Springer-Verlag 1976 - Edited by: A. van Wijngaarden, B.J. Mailloux, J.E.L. Peck, C.H.A. Koster, M. Sintzoff, C.H. Lindsey, L.G.L.T. Meertens and R.G. Fisker. +==Code samples== +Most of the code samples provided here have a leading main:( and a matching ) at the end. These are not actually required in the language, but are included so as to highlight that the code sample is complete, and works with (at least) [[ALGOL 68G]] unmodified. + +On some compilers, it may be necessary to include appropriate "job cards" +or precludes in order for the programs to compile successfully. Hopefully +not too much else is required. Examples: +{|border="1" style="border-collapse: collapse; border: 5px double grey;" align="center" +|| Brief Algol68 +|| Algol68 as in rosettacode +|| Actual ELLA Algol 68RS code +|- +|| + print(("Hello, world!",new line)) +|| + main:( + print(("Hello, world!",new line)) + ) +|| + PROGRAM helloworld CONTEXT VOID + USE standard + BEGIN + print(("Hello, world!", new line)) + END + FINISH +|} +===Example of different program representations=== +At the time when ALGOL 68 was defined some predominant computers had +36 bit words, and 6 bit character sets. Hence it was desirable that +ALGOL 68 should be able to run on machines with only uppercase. Hence +the official spec provided for different representations of the same +program. Example: +{|border="1" style="border-collapse: collapse; border: 5px double grey;" align="center" +|| Algol68 as typically published + ¢ bold/underline typeface ¢ + '''mode''' '''xint''' = '''int'''; + '''xint''' sum sq:=0; + '''for''' i '''while''' + sum sq≠70×70 + '''do''' + sum sq+:=i↑2 + '''od''' +|| quote stropping (similar to wiki) + 'pr' quote 'pr' + 'mode' 'xint' = 'int'; + 'xint' sum sq:=0; + 'for' i 'while' + sum sq≠70×70 + 'do' + sum sq+:=i↑2 + 'od' +|| Code for a 7-bit/ascii compiler + .PR UPPER .PR + MODE XINT = INT; + XINT sum sq:=0; + FOR i WHILE + sum sq/=70*70 + DO + sum sq+:=i**2 + OD +|| Code for a 6-bits/byte compiler + .PR POINT .PR + .MODE .XINT = .INT; + .XINT SUM SQ:=0; + .FOR I .WHILE + SUM SQ .NE 70*70 + .DO + SUM SQ .PLUSAB I .UP 2 + .OD +|| Algol68 using RES stropping + .PR RES .PR + mode .xint = int; + .xint sum sq:=0; + for i while + sum sq≠70×70 + do + sum sq+:=i↑2 + od +|} + +== Coercion (casting) == +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: +* 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 + +Depending on the context a MODE (type) will be coerced (widened) to another type 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 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 etc +Pointers are followed (dereferenced), For example: +* REF REF REAL to REAL +== Code Specimen == +{{language programming paradigm|Concurrent}} +{{language programming paradigm|Imperative}} \ No newline at end of file diff --git a/Lang/ALGOL-68/99-Bottles-of-Beer b/Lang/ALGOL-68/99-Bottles-of-Beer new file mode 120000 index 0000000000..65de91c87d --- /dev/null +++ b/Lang/ALGOL-68/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Ackermann-function b/Lang/ALGOL-68/Ackermann-function new file mode 120000 index 0000000000..97ae839907 --- /dev/null +++ b/Lang/ALGOL-68/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Arrays b/Lang/ALGOL-68/Arrays new file mode 120000 index 0000000000..16d3858c3d --- /dev/null +++ b/Lang/ALGOL-68/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Assertions b/Lang/ALGOL-68/Assertions new file mode 120000 index 0000000000..c7832e25ce --- /dev/null +++ b/Lang/ALGOL-68/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Binary-search b/Lang/ALGOL-68/Binary-search new file mode 120000 index 0000000000..d60a3809d1 --- /dev/null +++ b/Lang/ALGOL-68/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Binary-strings b/Lang/ALGOL-68/Binary-strings new file mode 120000 index 0000000000..610cd8fcaa --- /dev/null +++ b/Lang/ALGOL-68/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Bulls-and-cows b/Lang/ALGOL-68/Bulls-and-cows new file mode 120000 index 0000000000..ae868bb333 --- /dev/null +++ b/Lang/ALGOL-68/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Caesar-cipher b/Lang/ALGOL-68/Caesar-cipher new file mode 120000 index 0000000000..86f4aba2c5 --- /dev/null +++ b/Lang/ALGOL-68/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Calendar b/Lang/ALGOL-68/Calendar new file mode 120000 index 0000000000..f28fefdbb9 --- /dev/null +++ b/Lang/ALGOL-68/Calendar @@ -0,0 +1 @@ +../../Task/Calendar/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Classes b/Lang/ALGOL-68/Classes new file mode 120000 index 0000000000..574e90930a --- /dev/null +++ b/Lang/ALGOL-68/Classes @@ -0,0 +1 @@ +../../Task/Classes/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Define-a-primitive-data-type b/Lang/ALGOL-68/Define-a-primitive-data-type new file mode 120000 index 0000000000..47f79a9356 --- /dev/null +++ b/Lang/ALGOL-68/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Delete-a-file b/Lang/ALGOL-68/Delete-a-file new file mode 120000 index 0000000000..67b4b042e6 --- /dev/null +++ b/Lang/ALGOL-68/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Detect-division-by-zero b/Lang/ALGOL-68/Detect-division-by-zero new file mode 120000 index 0000000000..b928aedf86 --- /dev/null +++ b/Lang/ALGOL-68/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Determine-if-a-string-is-numeric b/Lang/ALGOL-68/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..26ff8622a5 --- /dev/null +++ b/Lang/ALGOL-68/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/FizzBuzz b/Lang/ALGOL-68/FizzBuzz new file mode 120000 index 0000000000..7ed0c1ac6c --- /dev/null +++ b/Lang/ALGOL-68/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Forest-fire b/Lang/ALGOL-68/Forest-fire new file mode 120000 index 0000000000..f7d85c501c --- /dev/null +++ b/Lang/ALGOL-68/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Infinity b/Lang/ALGOL-68/Infinity new file mode 120000 index 0000000000..06754ee068 --- /dev/null +++ b/Lang/ALGOL-68/Infinity @@ -0,0 +1 @@ +../../Task/Infinity/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Knuth-shuffle b/Lang/ALGOL-68/Knuth-shuffle new file mode 120000 index 0000000000..7f9e4b0bf8 --- /dev/null +++ b/Lang/ALGOL-68/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Narcissist b/Lang/ALGOL-68/Narcissist new file mode 120000 index 0000000000..a9f34e0755 --- /dev/null +++ b/Lang/ALGOL-68/Narcissist @@ -0,0 +1 @@ +../../Task/Narcissist/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Pi b/Lang/ALGOL-68/Pi new file mode 120000 index 0000000000..34758192d8 --- /dev/null +++ b/Lang/ALGOL-68/Pi @@ -0,0 +1 @@ +../../Task/Pi/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Quine b/Lang/ALGOL-68/Quine new file mode 120000 index 0000000000..99cd94562f --- /dev/null +++ b/Lang/ALGOL-68/Quine @@ -0,0 +1 @@ +../../Task/Quine/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-68/Search-a-list b/Lang/ALGOL-68/Search-a-list new file mode 120000 index 0000000000..59edcce483 --- /dev/null +++ b/Lang/ALGOL-68/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/ALGOL-68 \ No newline at end of file diff --git a/Lang/ALGOL-W/0DESCRIPTION b/Lang/ALGOL-W/0DESCRIPTION new file mode 100644 index 0000000000..fbd35eb835 --- /dev/null +++ b/Lang/ALGOL-W/0DESCRIPTION @@ -0,0 +1,32 @@ +{{language|ALGOL W +|parampass=both +|strength=strong +|safety=safe +|express=explicit +|compat=structural +|checking=both +|LCT=yes}} +Algol W is a successor to [[wp:Algol 60|Algol 60]] closely based on A +Contribution to the Development of ALGOL by [[wp:Niklaus Wirth|Niklaus Wirth]] +and [[wp:C.A.R. Hoare|C. A. R. Hoare]]. It includes dynamically +allocated records, string handling, complex numbers and a standard I/O +system. A copy of the Algol W Language Description can be found on Karl +Kleine's [http://www.fh-jena.de/~kleine/history/history.html Historic Documents in Computer Science] +page. [http://everything2.com/title/Algol%2520W Dabcanboulet's Algol W @ Everything2] +page contains an excellent +history and tutorial. + +[http://www.jampan.co.nz/~glyn/ aw2c] is a new compiler for the Algol W +language. It is a complete implementation of the language described in +the Algol W Language Description, June 1972. aw2c should be able to +compile code intended for the [[wp:OS/360|OS/360]] Algol W compilers +with little or no modification. See the aw2c manual for more details. + +aw2c correctly compiles Tony Marsland's computer [[wp:chess|chess]] player +[http://webdocs.cs.ualberta.ca/~tony/Public/Awit-Wita-ComputerChess/ Awit] +and Hendrik Boom's [http://mtn-host.prjek.net/projects/a68h/ A68H] +[[Algol 68]] compiler. + +== Code Specimen == +{{language programming paradigm|Concurrent}} +{{stub}} \ No newline at end of file diff --git a/Lang/ALGOL/0DESCRIPTION b/Lang/ALGOL/0DESCRIPTION new file mode 100644 index 0000000000..f66cf163bf --- /dev/null +++ b/Lang/ALGOL/0DESCRIPTION @@ -0,0 +1 @@ +{{language}}{{stub}} \ No newline at end of file diff --git a/Lang/AMPL/0DESCRIPTION b/Lang/AMPL/0DESCRIPTION new file mode 100644 index 0000000000..1721b8cb25 --- /dev/null +++ b/Lang/AMPL/0DESCRIPTION @@ -0,0 +1,5 @@ +{{stub}} +{{language +|site=http://www.ampl.com/ +}} +AMPL is a comprehensive and powerful algebraic modeling language for linear and nonlinear optimization problems, in discrete or continuous variables. One particular advantage of AMPL is the similarity of its syntax to the mathematical notation of optimization problems. \ No newline at end of file diff --git a/Lang/ANT/0DESCRIPTION b/Lang/ANT/0DESCRIPTION new file mode 100644 index 0000000000..3cdd7ec2f3 --- /dev/null +++ b/Lang/ANT/0DESCRIPTION @@ -0,0 +1,12 @@ +{{stub}} +{{language +|site=http://ant.berlios.de/ +}} +ANT (ant is not TeX) is a typesetting system inspired by [[TeX]]. In addition to all major features of TeX, ANT provides: +* an improved macro language +* a builtin high-level scripting language +* UNICODE support +* support for various font formats including Type1, TrueType, and OpenType +* partial support for advanced OpenType features +* support for colour and graphics +* simple page layout specifications \ No newline at end of file diff --git a/Lang/ANTLR/0DESCRIPTION b/Lang/ANTLR/0DESCRIPTION new file mode 100644 index 0000000000..98ac2ea159 --- /dev/null +++ b/Lang/ANTLR/0DESCRIPTION @@ -0,0 +1,5 @@ +{{language}} + +ANother Tool for Language Recognition, is a language tool that provides a framework for constructing recognizers, interpreters, compilers, and translators from grammatical descriptions containing actions in a variety of target languages. ANTLR provides excellent support for tree construction, tree walking, translation, error recovery, and error reporting. + +See: http://www.antlr.org/ \ No newline at end of file diff --git a/Lang/ANTLR/Balanced-brackets b/Lang/ANTLR/Balanced-brackets new file mode 120000 index 0000000000..e6f87cfe06 --- /dev/null +++ b/Lang/ANTLR/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/ANTLR \ No newline at end of file diff --git a/Lang/ANTLR/JSON b/Lang/ANTLR/JSON new file mode 120000 index 0000000000..e146f2a9d3 --- /dev/null +++ b/Lang/ANTLR/JSON @@ -0,0 +1 @@ +../../Task/JSON/ANTLR \ No newline at end of file diff --git a/Lang/APL/0DESCRIPTION b/Lang/APL/0DESCRIPTION new file mode 100644 index 0000000000..2252da77e4 --- /dev/null +++ b/Lang/APL/0DESCRIPTION @@ -0,0 +1,4 @@ +{{stub}}{{language|APL +|checking=dynamic}}{{language programming paradigm|functional}} + +APL is an array oriented interactive programming language and integrated development environment. \ No newline at end of file diff --git a/Lang/APL/Ackermann-function b/Lang/APL/Ackermann-function new file mode 120000 index 0000000000..9ac38aeba8 --- /dev/null +++ b/Lang/APL/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/APL \ No newline at end of file diff --git a/Lang/APL/Determine-if-a-string-is-numeric b/Lang/APL/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..8e8c31df37 --- /dev/null +++ b/Lang/APL/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/APL \ No newline at end of file diff --git a/Lang/APL/FizzBuzz b/Lang/APL/FizzBuzz new file mode 120000 index 0000000000..bbd46cfd13 --- /dev/null +++ b/Lang/APL/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/APL \ No newline at end of file diff --git a/Lang/ARM-Assembly/0DESCRIPTION b/Lang/ARM-Assembly/0DESCRIPTION new file mode 100644 index 0000000000..c9b9f3b5fe --- /dev/null +++ b/Lang/ARM-Assembly/0DESCRIPTION @@ -0,0 +1,3 @@ +{{stub}}{{language}}{{assembler language}} + +[[Category:Assembly]] \ No newline at end of file diff --git a/Lang/ASP.Net/0DESCRIPTION b/Lang/ASP.Net/0DESCRIPTION new file mode 100644 index 0000000000..9b7e1c4582 --- /dev/null +++ b/Lang/ASP.Net/0DESCRIPTION @@ -0,0 +1 @@ +{{language|site=http://www.asp.net/}}{{stub}} \ No newline at end of file diff --git a/Lang/ASP/0DESCRIPTION b/Lang/ASP/0DESCRIPTION new file mode 100644 index 0000000000..ef4cc0fcc8 --- /dev/null +++ b/Lang/ASP/0DESCRIPTION @@ -0,0 +1,5 @@ +{{language|site=http://msdn.microsoft.com/en-us/library/aa286483.aspx}} +{{implementation|VBScript}}{{implementation|JavaScript}} +'''Active Server Pages''', usually abbreviated as '''ASP''', is a scripting engine for web servers. Although developed by [[Microsoft]], and used almost exclusively under [[wp:Internet Information Services|IIS]], there are a few third-party implementations, most notably [http://www.apache-asp.org/ Apache::ASP] (and, before the Oracle buyout, Sun's Chilisoft ASP). + +By default, the Microsoft implementation of ASP includes [[:Category:VBScript|VBScript]] and [[:Category:JavaScript|JavaScript]], but can be extended to use other languages, such as [[wp:PerlScript|PerlScript]] (derived from [[:Category:Perl|Perl]]). \ No newline at end of file diff --git a/Lang/ATS/0DESCRIPTION b/Lang/ATS/0DESCRIPTION new file mode 100644 index 0000000000..c1ac018384 --- /dev/null +++ b/Lang/ATS/0DESCRIPTION @@ -0,0 +1,36 @@ +{{language +|exec=machine +|gc=allowed +|safety=safe +|parampass=both +|checking=static +|strength=strong +|express=explicit +|tags=ATS +|bnf=http://www.ats-lang.org/DOCUMENTATION/GRAMMAR/ats_grammar_desc.html +|site=http://www.ats-lang.org/ +|hopl=no +}} +{{language programming paradigm|Declarative}} +{{language programming paradigm|Functional}} +{{language programming paradigm|Imperative}} +{{language programming paradigm|Concurrent}} +{{language programming paradigm|Modular}} +'''ATS''' is a [[Type checking|statically typed]] programming language that unifies implementation with formal specification. It is equipped with a highly expressive [[type system]] rooted in the framework Applied Type System, which gives the language its name. In particular, both dependent types and linear types are available in ATS. + + + +* [[Functional programming]]. The core of ATS is a functional language based on eager (aka. call-by-value) evaluation, which can also accommodate lazy (aka. call-by-need) evaluation. The availability of linear types in ATS often makes functional programs written in it run not only with surprisingly high efficiency (when compared to [[C]]) but also with surprisingly small (memory) footprint (when compared to [[C]] as well). + +* [[Imperative programming]]. The novel and unique approach to imperative programming in ATS is firmly rooted in the paradigm of programming with theorem-proving. The type system of ATS allows many features considered dangerous in other languages (e.g., explicit pointer arithmetic and explicit memory allocation/deallocation) to be safely supported in ATS, making ATS a viable programming langauge for low-level systems programming. + +* [[Concurrent programming]]. ATS, equipped with a multicore-safe implementation of [[garbage collection]], can support multithreaded programming through the use of pthreads. The availability of linear types for tracking and safely manipulating resources provides a effective means to constructing reliable programs that can take advantage of multicore architectures. + +* [[Modular programming]]. The module system of ATS is largely infuenced by that of [[Modula-3]], which is both simple and general as well as effective in supporting large scale programming. + + + +In addition, ATS contains a subsystem ATS/LF that supports a form of (interactive) theorem-proving, where proofs are constructed as total functions. With this component, ATS advocates a programmer-centric approach to program verification that combines programming with theorem-proving in a syntactically intertwined manner. Furthermore, this component can serve as a logical framework for encoding deduction systems and their (meta-)properties. + +==Citations== +* [[wp:ATS_%28programming_language%29|Wikipedia:ATS (programming language)]] \ No newline at end of file diff --git a/Lang/ATS/99-Bottles-of-Beer b/Lang/ATS/99-Bottles-of-Beer new file mode 120000 index 0000000000..dd6d877b0c --- /dev/null +++ b/Lang/ATS/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/ATS \ No newline at end of file diff --git a/Lang/ATS/Ackermann-function b/Lang/ATS/Ackermann-function new file mode 120000 index 0000000000..847076f3b5 --- /dev/null +++ b/Lang/ATS/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/ATS \ No newline at end of file diff --git a/Lang/Agda/0DESCRIPTION b/Lang/Agda/0DESCRIPTION new file mode 100644 index 0000000000..85bf37c8e6 --- /dev/null +++ b/Lang/Agda/0DESCRIPTION @@ -0,0 +1,3 @@ +{{language|Agda +|site=http://wiki.portal.chalmers.se/agda/pmwiki.php}}{{implementation|Agda}}{{stub}} +Agda is a dependently typed functional programming language. \ No newline at end of file diff --git a/Lang/Agda2/0DESCRIPTION b/Lang/Agda2/0DESCRIPTION new file mode 100644 index 0000000000..ee67ec28e7 --- /dev/null +++ b/Lang/Agda2/0DESCRIPTION @@ -0,0 +1 @@ +{{language|Agda2}}{{implementation|Agda2}}{{stub}} \ No newline at end of file diff --git a/Lang/Agena/0DESCRIPTION b/Lang/Agena/0DESCRIPTION new file mode 100644 index 0000000000..5acb744daf --- /dev/null +++ b/Lang/Agena/0DESCRIPTION @@ -0,0 +1,21 @@ +{{language +|site=http://agena.sourceforge.net/ +|express=implicit}} +{{language programming paradigm|procedural}} +== What is Agena ? == +Agena is an easy-to-learn procedural programming language designed to be used in scientific, educational, linguistic, and many other applications. + +== What can you do with Agena ? == +Agena provides all the means to implement ideas quickly: fast real and complex arithmetics, efficient text processing, graphics, flexible data structures, intelligent procedures, simple package management, plus various configuration facilities in multi-user environments. + +Besides providing basic operations, it has advanced programming features such as high-speed processing of data structures, +extended conditionals, abridged and extended syntax for loops, efficient recursion techniques, an arbitrary precision mathematical library, easy-to-use package handling, and much more. + +== Which operating systems are supported ? == +Installers are available for [[Solaris]], [[Windows]], [[Linux]], [[Mac OS X]], [[OS/2]] & eComStation, and DOS. + +== How does it look like ? == +The syntax looks like very simplified [[ALGOL 68]] with elements taken from [[Lua]] and [[SQL]]. + +== How has it been implemented ? == +Agena is based on the [[ANSI]] [[C]] source code of [[Lua]], a popular and widely used Open Source programming language. \ No newline at end of file diff --git a/Lang/Aikido/0DESCRIPTION b/Lang/Aikido/0DESCRIPTION new file mode 100644 index 0000000000..4126891ffb --- /dev/null +++ b/Lang/Aikido/0DESCRIPTION @@ -0,0 +1,15 @@ +{{Wikipedia|Aikido (programming language)}} +{{language +|site=http://aikido.sourceforge.net/ +|compat=duck +|strength=weak}} +{{language programming paradigm|object-oriented}} +{{language programming paradigm|imperative}} +{{language programming paradigm|concurrent}} +'''Aikido''' is an interpreted language that can be used for rapid scripting, prototyping and general programming tasks. + +It was developed at [[Sun Microsystems|Sun Microsystems Laboratories]] by David Allison and released as open source in September 2003, with the most recent release dated June 2007. It is a dynamically typed, object oriented language with built-in multithreading. + +In some respects it is similar in functionality to [[Python]], [[Perl]], [[JavaScript]] and [[Java]]. Syntactically it is very similar to [[C++]] and Java. + +Aikido is available for Linux, Mac OS X and Solaris. The interpreter can be obtained from http://sourceforge.net/projects/aikido. Documentation (in PDF) is at http://downloads.sourceforge.net/aikido/aikido_prm.pdf \ No newline at end of file diff --git a/Lang/Aikido/Arrays b/Lang/Aikido/Arrays new file mode 120000 index 0000000000..b66c7f57fb --- /dev/null +++ b/Lang/Aikido/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Aikido \ No newline at end of file diff --git a/Lang/Aikido/Check-that-file-exists b/Lang/Aikido/Check-that-file-exists new file mode 120000 index 0000000000..56ce2b5b40 --- /dev/null +++ b/Lang/Aikido/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Aikido \ No newline at end of file diff --git a/Lang/Aikido/Classes b/Lang/Aikido/Classes new file mode 120000 index 0000000000..4d19216ef1 --- /dev/null +++ b/Lang/Aikido/Classes @@ -0,0 +1 @@ +../../Task/Classes/Aikido \ No newline at end of file diff --git a/Lang/Aikido/Delegates b/Lang/Aikido/Delegates new file mode 120000 index 0000000000..6ac82f0c07 --- /dev/null +++ b/Lang/Aikido/Delegates @@ -0,0 +1 @@ +../../Task/Delegates/Aikido \ No newline at end of file diff --git a/Lang/Aikido/Delete-a-file b/Lang/Aikido/Delete-a-file new file mode 120000 index 0000000000..eda88a8016 --- /dev/null +++ b/Lang/Aikido/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Aikido \ No newline at end of file diff --git a/Lang/Aime/0DESCRIPTION b/Lang/Aime/0DESCRIPTION new file mode 100644 index 0000000000..d66e830a7a --- /dev/null +++ b/Lang/Aime/0DESCRIPTION @@ -0,0 +1,4 @@ +{{language|aime +|site=http://sourceforge.net/projects/aime-embedded/ +}}{{language programming paradigm|Imperative}}[[derived from::C| ]] +''aime'' is a simple, [[C|C]]-like, [[procedural programming|procedural]], [[imperative programming|imperative]] computer programming language. It is designed as a lightweight language targeted towards application extension [http://en.wikipedia.org/wiki/List_of_programming_languages_by_category#Extension_languages]. As such, the aime interpreter is easily embeddable in other applications. For the same reasons, the language stresses application integrity and accessibility. \ No newline at end of file diff --git a/Lang/Aime/99-Bottles-of-Beer b/Lang/Aime/99-Bottles-of-Beer new file mode 120000 index 0000000000..65eb460373 --- /dev/null +++ b/Lang/Aime/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Aime \ No newline at end of file diff --git a/Lang/Algae/0DESCRIPTION b/Lang/Algae/0DESCRIPTION new file mode 100644 index 0000000000..6a063f3094 --- /dev/null +++ b/Lang/Algae/0DESCRIPTION @@ -0,0 +1,6 @@ +{{stub}} +{{language +|site=http://algae.sourceforge.net/ +}} + +Algae is an interpreted language for numerical analysis. \ No newline at end of file diff --git a/Lang/Alice-ML/0DESCRIPTION b/Lang/Alice-ML/0DESCRIPTION new file mode 100644 index 0000000000..64f573c86d --- /dev/null +++ b/Lang/Alice-ML/0DESCRIPTION @@ -0,0 +1,8 @@ +{{language|Alice ML +|site=http://www.ps.uni-saarland.de/alice/ +}} + +Alice ML is a functional programming language based on [[Standard ML]], With ideas from [[Oz]]. It has rich support for concurrent, distributed, and constraint programming. Alice ML extends [[Standard ML]] with laziness, light-weight concurrency with implicit data-flow synchronisation, higher-order functors and abstract signatures, Packages, Pickling, type-safe cross-platform remote functions and network mobility & Constraints. It also has a lot of similarities to [[Erlang]]. + +==See Also== +* [[wp:Alice_(programming_language)|Wikipedia: Alice ML]] \ No newline at end of file diff --git a/Lang/Alore/0DESCRIPTION b/Lang/Alore/0DESCRIPTION new file mode 100644 index 0000000000..c54f9e4e0b --- /dev/null +++ b/Lang/Alore/0DESCRIPTION @@ -0,0 +1,9 @@ +{{stub}}{{language +|exec=bytecode +|strength=strong +|checking=both +|gc=yes +|site=http://www.alorelang.org/}} +{{language programming paradigm|Object-oriented}} + +Alore is an [[object-oriented programming]] language with a clean syntax that resembles [[Python]] and [[Lua]]. Alore is optionally-typed like Google Dart: it is both a dynamic scripting language and a general-purpose language with static typing. It is aimed at diverse programming tasks, from short scripts to complex applications. Alore also allows you to freely mix static and dynamic typing within a program. \ No newline at end of file diff --git a/Lang/AmbientTalk/0DESCRIPTION b/Lang/AmbientTalk/0DESCRIPTION new file mode 100644 index 0000000000..a08b778a3b --- /dev/null +++ b/Lang/AmbientTalk/0DESCRIPTION @@ -0,0 +1,31 @@ +{{language|AmbientTalk +|strength=strong +|safety=safe +|express=explicit +|compat=duck +|checking=dynamic +|parampass=value +|gc=yes +|LCT=yes}} +AmbientTalk is a concurrent, distributed programming language designed specifically for mobile ad hoc networks. It's concurrency model is inspired by actors, and more specifically the event loop concurrency model of the [[E]] language. AmbientTalk has built-in support for distributed service discovery and (asynchronous) messaging. + +The language was designed at the Software Languages Lab of the Vrije Universiteit Brussel, primarily as a research framework for exploring new concurrent and distributed language features for highly dynamic, decentralized networks, such as wireless, mobile ad hoc networks. + +The default implementation of AmbientTalk is a Java interpreter, which features full interoperability with the JVM, enabling AmbientTalk code to use existing Java libraries, and enabling Java code to use AmbientTalk as a distributed scripting language. Recent version of AmbientTalk also run on the Android OS, making AmbientTalk portable across a wide range of mobile phones. + +==Trying AmbientTalk== + +[http://ambienttalk.googlecode.com The open source AmbientTalk interpreter] + +To run an AmbientTalk program: + + $ iat program.at + +To get a [[REPL]] (aka prompt, shell, interactive interpreter): + + $ iat + +==See Also== + +* [http://ambienttalk.googlecode.com Open source google code project] +* [http://soft.vub.ac.be/amop AmbientTalk home page] at the Software Languages Lab of the Vrije Universiteit Brussel. \ No newline at end of file diff --git a/Lang/AmigaE/0DESCRIPTION b/Lang/AmigaE/0DESCRIPTION new file mode 100644 index 0000000000..69e564f55b --- /dev/null +++ b/Lang/AmigaE/0DESCRIPTION @@ -0,0 +1,12 @@ +{{stub}}{{language|AmigaE +|site=http://strlen.com/e/}} +{{language programming paradigm|object-oriented}} +{{language programming paradigm|procedural}} +E is an object-oriented/procedural/unpure functional/whatever language with quite a popular implementation on the amiga. It's mainly influenced by languages such as C++, Ada, Lisp etc. (from the official site) + +Do not confuse [[E]] with AmigaE. Amiga E was born in 1993, E in 1997. Unluckily, they share the same name, and since Amiga E is the most popular (as far as I know, unique...!) implementation of E, and since Amiga E has some features that bind it to ''Amiga family'', the name AmigaE seems reasonable, even though HOPL reports it as E. + +The language was designed by Wouter von Oortmerssen, also the perpetrator of [[FALSE]]. + +==See Also== +* [[wp:Amiga E|Wikipedia: AmigaE]] \ No newline at end of file diff --git a/Lang/AmigaE/99-Bottles-of-Beer b/Lang/AmigaE/99-Bottles-of-Beer new file mode 120000 index 0000000000..42aab80adb --- /dev/null +++ b/Lang/AmigaE/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/AmigaE \ No newline at end of file diff --git a/Lang/AmigaE/Classes b/Lang/AmigaE/Classes new file mode 120000 index 0000000000..5c62844f1c --- /dev/null +++ b/Lang/AmigaE/Classes @@ -0,0 +1 @@ +../../Task/Classes/AmigaE \ No newline at end of file diff --git a/Lang/AmigaE/Comments b/Lang/AmigaE/Comments new file mode 120000 index 0000000000..525267aaf8 --- /dev/null +++ b/Lang/AmigaE/Comments @@ -0,0 +1 @@ +../../Task/Comments/AmigaE \ No newline at end of file diff --git a/Lang/AppleScript/0DESCRIPTION b/Lang/AppleScript/0DESCRIPTION new file mode 100644 index 0000000000..82f07d8d02 --- /dev/null +++ b/Lang/AppleScript/0DESCRIPTION @@ -0,0 +1,6 @@ +{{language|AppleScript}} + +This is a scripting language created by [[Apple, Inc]]. It provides a [[Mac]] user the ability to easily transfer data between applications and process the data to their needs. + +AppleScript is a trademark of Apple, Inc. +* [https://duckduckgo.com/?q=AppleScript Duck AppleScript] \ No newline at end of file diff --git a/Lang/AppleScript/FizzBuzz b/Lang/AppleScript/FizzBuzz new file mode 120000 index 0000000000..45f2771e5f --- /dev/null +++ b/Lang/AppleScript/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/AppleScript \ No newline at end of file diff --git a/Lang/AppleScript/Knuth-shuffle b/Lang/AppleScript/Knuth-shuffle new file mode 120000 index 0000000000..de7a0f63ee --- /dev/null +++ b/Lang/AppleScript/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/AppleScript \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/0DESCRIPTION b/Lang/Applesoft-BASIC/0DESCRIPTION new file mode 100644 index 0000000000..4669b84f59 --- /dev/null +++ b/Lang/Applesoft-BASIC/0DESCRIPTION @@ -0,0 +1,9 @@ +{{stub}}{{language|Applesoft BASIC +|exec=interpreted}} +{{implementation|BASIC}} + +'''Applesoft BASIC''' was a dialect of [[BASIC]] supplied with the [[wp:Apple II|Apple II]] series of computers. It superseded [[Integer BASIC]] and was the [[BASIC]] in ROM in all [[wp:Apple II|Apple II]] series computers after the original Apple II model. + +==See Also== +* [[wp:Applesoft BASIC|Wikipedia: Applesoft BASIC]] +* [http://www.landsnail.com/a2ref.htm Apple II Programmer's Reference] from ][ In a Mac, via [http://www.landsnail.com/ Landsnail.com] \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/99-Bottles-of-Beer b/Lang/Applesoft-BASIC/99-Bottles-of-Beer new file mode 120000 index 0000000000..cb96e37c7a --- /dev/null +++ b/Lang/Applesoft-BASIC/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Color-of-a-screen-pixel b/Lang/Applesoft-BASIC/Color-of-a-screen-pixel new file mode 120000 index 0000000000..e13a05f293 --- /dev/null +++ b/Lang/Applesoft-BASIC/Color-of-a-screen-pixel @@ -0,0 +1 @@ +../../Task/Color-of-a-screen-pixel/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Applesoft-BASIC/Detect-division-by-zero b/Lang/Applesoft-BASIC/Detect-division-by-zero new file mode 120000 index 0000000000..09ac14a83a --- /dev/null +++ b/Lang/Applesoft-BASIC/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Applesoft-BASIC \ No newline at end of file diff --git a/Lang/Application-Master/0DESCRIPTION b/Lang/Application-Master/0DESCRIPTION new file mode 100644 index 0000000000..4d3d27c049 --- /dev/null +++ b/Lang/Application-Master/0DESCRIPTION @@ -0,0 +1 @@ +{{stub}}{{language}} \ No newline at end of file diff --git a/Lang/Arbre/0DESCRIPTION b/Lang/Arbre/0DESCRIPTION new file mode 100644 index 0000000000..0d020e4dec --- /dev/null +++ b/Lang/Arbre/0DESCRIPTION @@ -0,0 +1,11 @@ +{{language|Arbre +|gc=yes +|untyped=yes +|tags=arbre +|site=http://code.google.com/p/arbrelang +}} + +Arbre is a tree-oriented parallel programming language. + +==Citations== +* [http://code.google.com/p/arbrelang/source/browse/#svn%2Ftrunk%2Fjs Source] \ No newline at end of file diff --git a/Lang/Arbre/99-Bottles-of-Beer b/Lang/Arbre/99-Bottles-of-Beer new file mode 120000 index 0000000000..9a6da5d7f7 --- /dev/null +++ b/Lang/Arbre/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Arbre \ No newline at end of file diff --git a/Lang/Arbre/FizzBuzz b/Lang/Arbre/FizzBuzz new file mode 120000 index 0000000000..f0c437ceb1 --- /dev/null +++ b/Lang/Arbre/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Arbre \ No newline at end of file diff --git a/Lang/Argile/0DESCRIPTION b/Lang/Argile/0DESCRIPTION new file mode 100644 index 0000000000..63f51c8b2f --- /dev/null +++ b/Lang/Argile/0DESCRIPTION @@ -0,0 +1,20 @@ +{{language +|site=http://www.nongnu.org/argile/}} +Argile is an experimental, [[C]]-based, compiled programming language, that produces C code. It is not intended for beginners, but for experienced programmers with a good knowledge of C. +Its main features are: +* Variable syntax +* Polymorphism-oriented +* Call guessing +* Keyword-less +* [[UTF-8]] based +* Access to low level programming +* Extensible through a module system +* Parametered types +* [[Object-oriented]] classes available +* Implicit type casters can be defined +* Definitions can be made after they are used +* Subfunctions and anonymous functions +* Both indentation-style and braces-style can be used + +==See also== +* [https://savannah.nongnu.org/projects/argile/ Argile project page on Savannah] \ No newline at end of file diff --git a/Lang/Argile/99-Bottles-of-Beer b/Lang/Argile/99-Bottles-of-Beer new file mode 120000 index 0000000000..5b3c0be83e --- /dev/null +++ b/Lang/Argile/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Argile \ No newline at end of file diff --git a/Lang/Argile/Ackermann-function b/Lang/Argile/Ackermann-function new file mode 120000 index 0000000000..9d48b71180 --- /dev/null +++ b/Lang/Argile/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Argile \ No newline at end of file diff --git a/Lang/Argile/Arrays b/Lang/Argile/Arrays new file mode 120000 index 0000000000..c6295d052a --- /dev/null +++ b/Lang/Argile/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Argile \ No newline at end of file diff --git a/Lang/Argile/Infinity b/Lang/Argile/Infinity new file mode 120000 index 0000000000..c7b2b6655f --- /dev/null +++ b/Lang/Argile/Infinity @@ -0,0 +1 @@ +../../Task/Infinity/Argile \ No newline at end of file diff --git a/Lang/AspectC++/0DESCRIPTION b/Lang/AspectC++/0DESCRIPTION new file mode 100644 index 0000000000..4871206440 --- /dev/null +++ b/Lang/AspectC++/0DESCRIPTION @@ -0,0 +1,9 @@ +{{stub}}{{language|AspectC++ +|site=http://www.aspectc.org/ +}} + +AspectC++ is an aspect-oriented extension of [[C]] and [[C++]] languages. It is based on source-to-source translation, translating AspectC++ source code to +[[C++]]. + +==See Also== +*[[wp:AspectC++|Wikipedia AspectC++]] \ No newline at end of file diff --git a/Lang/AspectJ/0DESCRIPTION b/Lang/AspectJ/0DESCRIPTION new file mode 100644 index 0000000000..c2a7092c45 --- /dev/null +++ b/Lang/AspectJ/0DESCRIPTION @@ -0,0 +1,7 @@ +{{language|AspectJ +|site=http://www.eclipse.org/aspectj/ +}}[[runs on vm::java virtual machine| ]] +AspectJ is an aspect-oriented extension of [[derived from::Java]]. AspectJ has become the de-facto standard for [[Aspect Oriented Programming]] (AOP). + +==See Also== +* [[wp:AspectJ| Wikipedia: AspectJ]] \ No newline at end of file diff --git a/Lang/Assembly/0DESCRIPTION b/Lang/Assembly/0DESCRIPTION new file mode 100644 index 0000000000..40f2626a4f --- /dev/null +++ b/Lang/Assembly/0DESCRIPTION @@ -0,0 +1,9 @@ +{{language}}{{assembler language}} +[[Category:Encyclopedia]]'''Assembly language''' (or just '''assembly'''; often abbreviated '''asm'''; sometimes called '''assembler''', although that more properly refers to the program that translates the assembly source into machine code) is a term used for a language which is as close to raw machine code as a language can get. + +Usually assembly languages use textual "[[wp:mnemonic|mnemonic]]" instructions that correspond directly to binary machine code instructions (merely hiding details of bit-wise encoding), except for ''macros'' which expand to multiple instructions, and often give direct control over the overall layout of the assembled program on disk and in memory. Available instructions and codes are specific to the architecture being programmed on (although there are assemblers which provide an abstracted, non-architecture-specific language; the most notable one is the [[wp:GNU Assembler|GNU Assembler]]). Assembly programs are typically loaded directly into a computer's memory and run from there. + +==See also== +*[[wp:Assembly language|Assembly language]] on Wikipedia (includes an in-depth discussion of assembly) +*[[wp:High-level assembler|High-level assembler]] (a.k.a. ''macro assembler'') on Wikipedia +*Compare with [[wp:Microcode|Microcode]]. \ No newline at end of file diff --git a/Lang/Asymptote/0DESCRIPTION b/Lang/Asymptote/0DESCRIPTION new file mode 100644 index 0000000000..4d3d27c049 --- /dev/null +++ b/Lang/Asymptote/0DESCRIPTION @@ -0,0 +1 @@ +{{stub}}{{language}} \ No newline at end of file diff --git a/Lang/AutoHotkey/0DESCRIPTION b/Lang/AutoHotkey/0DESCRIPTION new file mode 100644 index 0000000000..3c6c3eb60d --- /dev/null +++ b/Lang/AutoHotkey/0DESCRIPTION @@ -0,0 +1,15 @@ +{{language|AutoHotkey +|gc=no +|parampass=both +|untyped=yes +|tags=ahk, autohotkey +|site=http://www.autohotkey.com/ +|LCT=yes}}'''[[wp:AutoHotkey|AutoHotkey]]''' is an [[open source]] programming language for Microsoft [[Windows]]. +==Citations== +* [http://autohotkey.com/docs Documentation] +* [http://autohotkey.net/ AutoHotkey.net] - user projects and [http://www.autohotkey.net/#archives archives] +* [http://www.autohotkey.com/docs/scripts/ Script Showcase], [http://www.autohotkey.com/wiki/index.php?title=Script_Listing scripts: wiki] +* [http://www.autohotkey.com/forum/ Community forum] +* [[wp:AutoHotkey|AutoHotkey on Wikipedia]] +* [irc://irc.freenode.net/ahk #ahk] on [[Help:IRC|freenode]] ([http://webchat.freenode.net/?channels=%23ahk Web interface]) +* [[:Category:AutoHotkey_Originated]] \ No newline at end of file diff --git a/Lang/AutoHotkey/99-Bottles-of-Beer b/Lang/AutoHotkey/99-Bottles-of-Beer new file mode 120000 index 0000000000..d611bb82f4 --- /dev/null +++ b/Lang/AutoHotkey/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Ackermann-function b/Lang/AutoHotkey/Ackermann-function new file mode 120000 index 0000000000..f9f1f55e18 --- /dev/null +++ b/Lang/AutoHotkey/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Anagrams b/Lang/AutoHotkey/Anagrams new file mode 120000 index 0000000000..d0dacb1504 --- /dev/null +++ b/Lang/AutoHotkey/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Arrays b/Lang/AutoHotkey/Arrays new file mode 120000 index 0000000000..4c7c80d367 --- /dev/null +++ b/Lang/AutoHotkey/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Assertions b/Lang/AutoHotkey/Assertions new file mode 120000 index 0000000000..7743a6d84f --- /dev/null +++ b/Lang/AutoHotkey/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Balanced-brackets b/Lang/AutoHotkey/Balanced-brackets new file mode 120000 index 0000000000..7786dfb5cb --- /dev/null +++ b/Lang/AutoHotkey/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Best-shuffle b/Lang/AutoHotkey/Best-shuffle new file mode 120000 index 0000000000..71935fa7bc --- /dev/null +++ b/Lang/AutoHotkey/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Binary-search b/Lang/AutoHotkey/Binary-search new file mode 120000 index 0000000000..e14829707d --- /dev/null +++ b/Lang/AutoHotkey/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Bulls-and-cows b/Lang/AutoHotkey/Bulls-and-cows new file mode 120000 index 0000000000..85c2607682 --- /dev/null +++ b/Lang/AutoHotkey/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Caesar-cipher b/Lang/AutoHotkey/Caesar-cipher new file mode 120000 index 0000000000..66cf0aab03 --- /dev/null +++ b/Lang/AutoHotkey/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Check-that-file-exists b/Lang/AutoHotkey/Check-that-file-exists new file mode 120000 index 0000000000..7e8fa677af --- /dev/null +++ b/Lang/AutoHotkey/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Classes b/Lang/AutoHotkey/Classes new file mode 120000 index 0000000000..f07ef6dd3d --- /dev/null +++ b/Lang/AutoHotkey/Classes @@ -0,0 +1 @@ +../../Task/Classes/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Collections b/Lang/AutoHotkey/Collections new file mode 120000 index 0000000000..8d027d9af8 --- /dev/null +++ b/Lang/AutoHotkey/Collections @@ -0,0 +1 @@ +../../Task/Collections/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Color-of-a-screen-pixel b/Lang/AutoHotkey/Color-of-a-screen-pixel new file mode 120000 index 0000000000..e417b9797f --- /dev/null +++ b/Lang/AutoHotkey/Color-of-a-screen-pixel @@ -0,0 +1 @@ +../../Task/Color-of-a-screen-pixel/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Comments b/Lang/AutoHotkey/Comments new file mode 120000 index 0000000000..0ca9ba1827 --- /dev/null +++ b/Lang/AutoHotkey/Comments @@ -0,0 +1 @@ +../../Task/Comments/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Delete-a-file b/Lang/AutoHotkey/Delete-a-file new file mode 120000 index 0000000000..fc71e4d3ab --- /dev/null +++ b/Lang/AutoHotkey/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Detect-division-by-zero b/Lang/AutoHotkey/Detect-division-by-zero new file mode 120000 index 0000000000..79cf2b324c --- /dev/null +++ b/Lang/AutoHotkey/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Determine-if-a-string-is-numeric b/Lang/AutoHotkey/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..e25f39e40a --- /dev/null +++ b/Lang/AutoHotkey/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/FizzBuzz b/Lang/AutoHotkey/FizzBuzz new file mode 120000 index 0000000000..28b00312c8 --- /dev/null +++ b/Lang/AutoHotkey/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Forest-fire b/Lang/AutoHotkey/Forest-fire new file mode 120000 index 0000000000..d2e8a12db6 --- /dev/null +++ b/Lang/AutoHotkey/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Knuth-shuffle b/Lang/AutoHotkey/Knuth-shuffle new file mode 120000 index 0000000000..d1a69320ad --- /dev/null +++ b/Lang/AutoHotkey/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Ordered-words b/Lang/AutoHotkey/Ordered-words new file mode 120000 index 0000000000..ef12b43c4f --- /dev/null +++ b/Lang/AutoHotkey/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Quine b/Lang/AutoHotkey/Quine new file mode 120000 index 0000000000..4568e800da --- /dev/null +++ b/Lang/AutoHotkey/Quine @@ -0,0 +1 @@ +../../Task/Quine/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoHotkey/Search-a-list b/Lang/AutoHotkey/Search-a-list new file mode 120000 index 0000000000..c95865b7a6 --- /dev/null +++ b/Lang/AutoHotkey/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/AutoHotkey \ No newline at end of file diff --git a/Lang/AutoIt/0DESCRIPTION b/Lang/AutoIt/0DESCRIPTION new file mode 100644 index 0000000000..b47d23d92e --- /dev/null +++ b/Lang/AutoIt/0DESCRIPTION @@ -0,0 +1,10 @@ +{{stub}} +{{language +|site=http://www.autoitscript.com/autoit3/index.shtml +}} +AutoIt is a freeware scripting language for Microsoft Windows with a [[BASIC]]-like Syntax. + +An AutoIt script can be compiled into a compressed, stand-alone executable which can be run on computers that do not have the AutoIt interpreter installed. A wide range of function libraries (known as UDF's, or "User Defined Functions") are also included as standard or are available from the website to add specialized functionality. AutoIt can also use Win32 DLL's and Libraries like OpenGL, DirectX or any third-party DLL API. This makes 3D Game Development as well as WinAPI Handling possible to use in AutoIt. + +== See Also == +[[wp:AutoIt|Wikipedia:AutoIt]] \ No newline at end of file diff --git a/Lang/AutoIt/99-Bottles-of-Beer b/Lang/AutoIt/99-Bottles-of-Beer new file mode 120000 index 0000000000..cdfbe2b20a --- /dev/null +++ b/Lang/AutoIt/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/AutoIt \ No newline at end of file diff --git a/Lang/AutoIt/Arrays b/Lang/AutoIt/Arrays new file mode 120000 index 0000000000..293c3494bd --- /dev/null +++ b/Lang/AutoIt/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/AutoIt \ No newline at end of file diff --git a/Lang/AutoIt/Balanced-brackets b/Lang/AutoIt/Balanced-brackets new file mode 120000 index 0000000000..c6b6c318be --- /dev/null +++ b/Lang/AutoIt/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/AutoIt \ No newline at end of file diff --git a/Lang/AutoIt/Caesar-cipher b/Lang/AutoIt/Caesar-cipher new file mode 120000 index 0000000000..09eb8ad098 --- /dev/null +++ b/Lang/AutoIt/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/AutoIt \ No newline at end of file diff --git a/Lang/AutoIt/Color-of-a-screen-pixel b/Lang/AutoIt/Color-of-a-screen-pixel new file mode 120000 index 0000000000..3083e58011 --- /dev/null +++ b/Lang/AutoIt/Color-of-a-screen-pixel @@ -0,0 +1 @@ +../../Task/Color-of-a-screen-pixel/AutoIt \ No newline at end of file diff --git a/Lang/AutoIt/Comments b/Lang/AutoIt/Comments new file mode 120000 index 0000000000..246b634810 --- /dev/null +++ b/Lang/AutoIt/Comments @@ -0,0 +1 @@ +../../Task/Comments/AutoIt \ No newline at end of file diff --git a/Lang/AutoIt/FizzBuzz b/Lang/AutoIt/FizzBuzz new file mode 120000 index 0000000000..7260190578 --- /dev/null +++ b/Lang/AutoIt/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/AutoIt \ No newline at end of file diff --git a/Lang/AutoIt/Knuth-shuffle b/Lang/AutoIt/Knuth-shuffle new file mode 120000 index 0000000000..657ed14895 --- /dev/null +++ b/Lang/AutoIt/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/AutoIt \ No newline at end of file diff --git a/Lang/Axiom/0DESCRIPTION b/Lang/Axiom/0DESCRIPTION new file mode 100644 index 0000000000..00282faf71 --- /dev/null +++ b/Lang/Axiom/0DESCRIPTION @@ -0,0 +1,10 @@ +{{language|Axiom +|strength=strong +|checking=static +|gc=yes +|LCT=yes}}{{implementation|Axiom}}{{language programming paradigm|Declarative}} +[http://axiom-developer.org/ Axiom] is a general purpose Computer Algebra system. It is useful for research and development of mathematical algorithms. It defines a strongly typed, mathematically correct type hierarchy. It has a programming language and a built-in compiler. + +
+ +[[Category:Mathematical programming languages]] \ No newline at end of file diff --git a/Lang/Axum/0DESCRIPTION b/Lang/Axum/0DESCRIPTION new file mode 100644 index 0000000000..49ada68848 --- /dev/null +++ b/Lang/Axum/0DESCRIPTION @@ -0,0 +1,5 @@ +{{stub}} +{{language +|site=http://msdn.microsoft.com/en-us/devlabs/dd795202.aspx +}} +Axum is a language that builds upon the architecture of the Web and principles of isolation, actors, and message-passing to increase application safety, responsiveness, scalability, and developer productivity. \ No newline at end of file diff --git a/Meta/00Langs.yaml b/Meta/00Langs.yaml index 5c7ab13e58..b6a144c478 100644 --- a/Meta/00Langs.yaml +++ b/Meta/00Langs.yaml @@ -14,6 +14,41 @@ name: 4D path: 4D url: 4D +4DOS Batch: + ext: 4dos + name: 4DOS Batch + path: 4DOS-Batch + url: 4DOS_Batch +6502 Assembly: + ext: '6502' + name: 6502 Assembly + path: 6502-Assembly + url: 6502_Assembly +6800 Assembly: + ext: '6800' + name: 6800 Assembly + path: 6800-Assembly + url: 6800_Assembly +8 1/2: + ext: '8' + name: 8 1/2 + path: 8-1-2 + url: 8_1/2 +80386 Assembly: + ext: '80386' + name: 80386 Assembly + path: 80386-Assembly + url: 80386_Assembly +8080 Assembly: + ext: '8080' + name: 8080 Assembly + path: 8080-Assembly + url: 8080_Assembly +8086 Assembly: + ext: '8086' + name: 8086 Assembly + path: 8086-Assembly + url: 8086_Assembly A+: ext: a+ name: A+ @@ -29,6 +64,66 @@ ACL2: name: ACL2 path: ACL2 url: ACL2 +ALGOL: + ext: alg + name: ALGOL + path: ALGOL + url: ALGOL +ALGOL 60: + ext: alg + name: ALGOL 60 + path: ALGOL-60 + url: ALGOL_60 +ALGOL 68: + ext: alg + name: ALGOL 68 + path: ALGOL-68 + url: ALGOL_68 +ALGOL W: + ext: alg + name: ALGOL W + path: ALGOL-W + url: ALGOL_W +AMPL: + ext: ampl + name: AMPL + path: AMPL + url: AMPL +ANT: + ext: ant + name: ANT + path: ANT + url: ANT +ANTLR: + ext: antlr + name: ANTLR + path: ANTLR + url: ANTLR +APL: + ext: apl + name: APL + path: APL + url: APL +ARM Assembly: + ext: arm + name: ARM Assembly + path: ARM-Assembly + url: ARM_Assembly +ASP: + ext: asp + name: ASP + path: ASP + url: ASP +ASP.Net: + ext: asp + name: ASP.Net + path: ASP.Net + url: ASP.Net +ATS: + ext: ats + name: ATS + path: ATS + url: ATS AWK: ext: awk name: AWK @@ -44,6 +139,121 @@ Ada: name: Ada path: Ada url: Ada +Agda: + ext: agda + name: Agda + path: Agda + url: Agda +Agda2: + ext: agda2 + name: Agda2 + path: Agda2 + url: Agda2 +Agena: + ext: agena + name: Agena + path: Agena + url: Agena +Aikido: + ext: aikido + name: Aikido + path: Aikido + url: Aikido +Aime: + ext: aime + name: Aime + path: Aime + url: Aime +Algae: + ext: algae + name: Algae + path: Algae + url: Algae +Alice ML: + ext: alice + name: Alice ML + path: Alice-ML + url: Alice_ML +Alore: + ext: alore + name: Alore + path: Alore + url: Alore +AmbientTalk: + ext: ambient + name: AmbientTalk + path: AmbientTalk + url: AmbientTalk +AmigaE: + ext: amiga + name: AmigaE + path: AmigaE + url: AmigaE +AppleScript: + ext: applescript + name: AppleScript + path: AppleScript + url: AppleScript +Applesoft BASIC: + ext: bas + name: Applesoft BASIC + path: Applesoft-BASIC + url: Applesoft_BASIC +Application Master: + ext: application + name: Application Master + path: Application-Master + url: Application_Master +Arbre: + ext: arbre + name: Arbre + path: Arbre + url: Arbre +Argile: + ext: argile + name: Argile + path: Argile + url: Argile +AspectC++: + ext: acpp + name: AspectC++ + path: AspectC++ + url: AspectC++ +AspectJ: + ext: aspectj + name: AspectJ + path: AspectJ + url: AspectJ +Assembly: + ext: .as + name: Assembly + path: Assembly + url: Assembly +Asymptote: + ext: asymptote + name: Asymptote + path: Asymptote + url: Asymptote +AutoHotkey: + ext: ahk + name: AutoHotkey + path: AutoHotkey + url: AutoHotkey +AutoIt: + ext: autoit + name: AutoIt + path: AutoIt + url: AutoIt +Axiom: + ext: axiom + name: Axiom + path: Axiom + url: Axiom +Axum: + ext: axum + name: Axum + path: Axum + url: Axum B: ext: b name: B diff --git a/Task/99-Bottles-of-Beer/6502-Assembly/99-bottles-of-beer.6502 b/Task/99-Bottles-of-Beer/6502-Assembly/99-bottles-of-beer.6502 new file mode 100644 index 0000000000..2c45e183fd --- /dev/null +++ b/Task/99-Bottles-of-Beer/6502-Assembly/99-bottles-of-beer.6502 @@ -0,0 +1,157 @@ + .CR 6502 + .TF AP1BEER.O,AP1 + .LF AP1BEER.LST + .OR $0BEE +;-------------------------------------; +; BEER SONG IN 6502 ASSEMBLY LANGUAGE ; +; BY BARRYM 2010-05-30 ; +; THANKS TO SBPROJECTS.COM FOR LOTS ; +; OF VALUABLE INFORMATION AND A ; +; VERY NICE ASSEMBLER! ; +;-------------------------------------; +; THE TARGET MACHINE FOR THIS PROGRAM ; +; IS THE APPLE 1, BUT IT WOULD BE ; +; EASY TO MAKE IT RUN ON OTHER 65XX ; +; MACHINES BY CHANGING THE NEXT TWO ; +; EQUATES. SOME MACHINE-TESTED ; +; EXAMPLES: ; +; APPLE II, +, E, C: $FDED, $80 ; +; COMMODORE 64: $FFD2, $00 ; +;-------------------------------------; +ECHO = $FFEF EMIT A REG AS ASCII +ORMASK = $80 ($00 FOR + ASCII) +; +MAXBEER = 99 INITIAL BEER COUNT +;-------------------------------------; +; X REG. IS THE BOTTLE COUNTER. ; +; Y REG. IS THE STRING INDEX POINTER, ; +; AND THE TENS DIGIT IN THE BINARY- ; +; TO-ASCII CONVERSION ROUTINE. ; +; A REG. HANDLES EVERYTHING ELSE WITH ; +; A LITTLE HELP FROM THE STACK. ; +; ZERO PAGE ISN'T DIRECTLY DISTURBED. ; +;-------------------------------------; +; EMIT COMPLETE CORRECT SONG ADJUSTED ; +; FOR UPPER-CASE 40-COLUMN DISPLAY. ; +;-------------------------------------; + LDX #MAXBEER X=MAXBEER + BNE PRSONG SING THE SONG & RTS +;-------------------------------------; +; EMIT WHOLE SONG UP TO LAST SENTENCE.; +;-------------------------------------; +BEERME: + LDY #TAKE1-TXT ? "TAKE ... AROUND," + JSR PRBOB ? X;" BOT ... WALL." +PRSONG: ; ? + LDY #CR-TXT ? X;" BOT ... WALL," + JSR PRBOB ? X;" BOT ... BEER." + DEX X=X-1 + BPL BEERME IF X>=0 THEN BEERME +;-------------------------------------; +; EMIT LAST SENTENCE AND FALL THROUGH.; +;-------------------------------------; + LDX #MAXBEER X=MAXBEER: +; ? "GO TO ... MORE," +;-------------------------------------; +; PRINT A PROPERLY PUNCTUATED "BOTTLE ; +; OF BEER" SENTENCE. ; +;-------------------------------------; +PRBOB: + TYA + PHA SAVE THE PRE$ PTR + JSR PUTS ? PRE$; + TXA IF X=0 THEN + BEQ PRBOTT ? "NO MORE"; + LDY #"0"-1 ELSE + SEC ( +DIV10: + SBC #10 Y=INT(X/10) + INY + BCS DIV10 + ADC #10+'0' + CPY #"0" + BEQ ONEDIG + PHA IF Y>0 THEN + TYA ? Y; + JSR PUTCH + PLA ? X MOD 10; +ONEDIG: + LDY #BOTTL-TXT ) +PRBOTT: + JSR PUTCH ? " BOTTLE"; + CPX #1 + BNE PLURAL + INY IF X<>1 THEN ? "S"; +PLURAL: + JSR PUTS ? " OF BEER"; + PLA RECALL THE PRE$ PTR + CMP #COMCR-TXT + BEQ PRDOT + PHA IF APPROPRIATE THEN + JSR PUTS ? " ON THE WALL"; + PLA + LDY #COMCR-TXT IF APPROPRIATE THEN + CMP #CR-TXT ? ",": + BEQ PRBOB ? X;" ... BEER"; +PRDOT: + LDY #DOTCR-TXT ? "." +;-------------------------------------; +; EMIT A HI-BIT-SET TERMINATED STRING ; +; @ OFFSET Y AND EXIT WITH Y @ THE ; +; BEGINNING OF THE NEXT STRING. ; +;-------------------------------------; +PUTS: + LDA TXT,Y GRAB A STRING CHAR + INY ADVANCE STRING PTR +PUTCH: + PHA + ORA #ORMASK + AND #ORMASK+127 FORMAT CHAR FOR ECHO + JSR ECHO SHOOT IT TO CONSOLE + PLA + BPL PUTS LOOP IF APPROPRIATE + RTS +;-------------------------------------; +; OPTIMIZED SONG LYRIC STRINGS. ; +;-------------------------------------; +TXT: +TAKE1: + .AS "TAKE ONE DOWN AND" + .AS " PASS IT AROUND" +COMCR: + .AS "," +CR: + .AT #13 + .AS "NO MORE" +BOTTL: + .AT " BOTTLE" + .AT "S OF BEER" + .AT " ON THE WALL" +DOTCR: + .AT ".",#13 + .AS "GO TO THE STORE AND" + .AT " BUY SOME MORE,",#13 + .EN +;-------------------------------------; +; APPLE 1 MONITOR HEX DUMP FOLLOWS. ; +; ENTER AS SHOWN INTO THE MONITOR, ; +; AND LET THE BEER FLOW!! ; +;-------------------------------------; +0BEE +:A2 63 D0 05 A0 00 20 01 0C A0 21 20 01 +:0C CA 10 F3 A2 63 98 48 20 3C 0C 8A F0 +:16 A0 AF 38 E9 0A C8 B0 FB 69 3A C0 B0 +:F0 06 48 98 20 40 0C 68 A0 29 20 40 0C +:E0 01 D0 01 C8 20 3C 0C 68 C9 20 F0 0B +:48 20 3C 0C 68 A0 20 C9 21 F0 C7 A0 45 +:B9 4C 0C C8 48 09 80 29 FF 20 EF FF 68 +:10 F1 60 54 41 4B 45 20 4F 4E 45 20 44 +:4F 57 4E 20 41 4E 44 20 50 41 53 53 20 +:49 54 20 41 52 4F 55 4E 44 2C 8D 4E 4F +:20 4D 4F 52 45 20 42 4F 54 54 4C C5 53 +:20 4F 46 20 42 45 45 D2 20 4F 4E 20 54 +:48 45 20 57 41 4C CC 2E 8D 47 4F 20 54 +:4F 20 54 48 45 20 53 54 4F 52 45 20 41 +:4E 44 20 42 55 59 20 53 4F 4D 45 20 4D +:4F 52 45 2C 8D +BEER diff --git a/Task/99-Bottles-of-Beer/6800-Assembly/99-bottles-of-beer.6800 b/Task/99-Bottles-of-Beer/6800-Assembly/99-bottles-of-beer.6800 new file mode 100644 index 0000000000..350410f0cf --- /dev/null +++ b/Task/99-Bottles-of-Beer/6800-Assembly/99-bottles-of-beer.6800 @@ -0,0 +1,157 @@ + .cr 6800 + .tf beer6800.obj,AP1 + .lf beer6800 +;=====================================================; +; Beer Song for the Motorola 6800 microprocessor ; +; by barrym 2011-04-19 ; +;-----------------------------------------------------; +; Prints the correct, complete song lyrics to a full ; +; ascii terminal (console) connected to a 1970s ; +; vintage SWTPC 6800 system, which is the target ; +; device for this assembly. ; +; Many thanks to: ; +; swtpc.com for hosting Michael Holley's documents! ; +; sbprojects.com for a very nice assembler! ; +; swtpcemu.com for a very capable emulator! ; +; The 6800 microprocessor is the slightly older, less ; +; popular, and more expensive step-brother of the ; +; 6502. Numerous similarities exist between the ; +; assembly languages of the two, but the 6800 has ; +; its own distinct flavor, which is (judging by how ; +; compact the code ended up) well suited to this ; +; type of small program. I am especially impressed ; +; with the two-byte 'bsr' instruction, and I make ; +; extensive use of it here. ; +; Effort was made to keep the code footprint as small ; +; as possible by re-using substrings and code in a ; +; hacker-like style that makes the program flow a ; +; bit strange to the human eye (the 6800 gobbles it ; +; up without complaint). The final tally: 97 bytes ; +; of instructions, 108 bytes of text, and about 11 ; +; bytes of stack. This includes integer-to-ascii ; +; conversion, blank line between verses, removal of ; +; "s" from "1 bottles", substitution of "no more" ; +; for "0", and proper capitalization of "No more". ; +; reg b is the beer counter ; +; reg x is the string pointer ; +; reg a handles everything else (with a little help ; +; from the system stack) ; +;-----------------------------------------------------; +outeee = $e1d1 ROM: console putchar routine +stbeer = 99 Must be in the range [0..99] + .or $0f00 +;=====================================================; +; Initialize, sing the song, and exit ; +;-----------------------------------------------------; +main ldab #stbeer Beer count = stbeer + bsr prsong Sing the entire song + swi Return to the monitor. +;=====================================================; +; Emit the entire song up to the last sentence ; +;-----------------------------------------------------; +beerme bsr prbob2 Emit second sentence of verse +prsong ldx #nline Blank line between verses + ldaa #'N' First sentence type = 'N' + bsr prbob Emit 1st sentence of verse + decb Beer count -= 1 + bpl beerme If beer count >= 0 then beerme +;=====================================================; +; Set up the last sentence and fall through to prbob2 ; +;-----------------------------------------------------; + ldab #stbeer Beer count = stbeer + ldx #store x$ = "Go to the store ..." +;=====================================================; +; Emit a properly punctuated bottle-of-beer sentence, ; +; using beer counter in reg b, pre-string pointer ; +; in reg x, and the sentence type in reg a ('N' = ; +; sentence 1, 'o' = sentence 1.5, 'n' = sentence 2) ; +;-----------------------------------------------------; +prbob2 ldaa #'n' Second sentence type = 'n' +prbob psha Stack sentence type for later + bsr puts Emit pre-string + pula Check sentence type and use + psha it to prepare the upper- or + anda #'n' lower-case of "no more" + ldx #omore x$ = "o more bottle" + tstb If beer count = 0 then + beq prbott skip over the i-to-a + ldx #bottl x$ = " bottle" +;=====================================================; +; I-to-A (inline): convert int in b to ascii and emit ; +; with leading zero suppression (0 <= # <= 99)! ; +;-----------------------------------------------------; + pshb Stack beer count + ldaa #-1 (divten trashes it) +divten subb #10 b = ones digit - 10 + inca a = tens digit + bcc divten If a = 0 then + beq onedig suppress leading zero + adda #"0" else translate tens digit to + bsr putch shifted ascii and emit +onedig addb #'0'+10 Translate ones digit to ascii + tba and leave it in a for putch + pulb Restore beer count +;-----------------------------------------------------; +prbott bsr putch Emit a;x$; + cmpb #1 If beer count = 1 + bne plural then + inx skip over the "s" +plural bsr puts Emit " ... beer"; + pula Restore sentence type + cmpa #'o' If type <> 'o' + beq putdot then + psha emit " on the wall"; + bsr puts if type = 'N' then loop + pula back to finish the + adda #33 first sentence with + bpl prbob type = 'o', x$ = ", " +putdot ldx #dotnl x$ = ".\n" +;=====================================================; +; Emit string @ x and leave x @ start of next string ; +;-----------------------------------------------------; +puts ldaa 0,x a = raw character removed + inx from the beginning of x$ +;=====================================================; +; Emit a as ascii and loop into x$ if hi-bit is clear ; +;-----------------------------------------------------; +putch psha Stack raw char + anda #$7f Mask off the hi-bit + jsr outeee Emit a as 7-bit ascii + pula Restore raw char + tsta If hi-bit is clear then + bpl puts loop back into x$ + rts All 8 'bsr's use this 'rts'! +;=====================================================; +; Optimized song lyric strings, carefully arranged to ; +; allow the prbob subroutine to take full advantage ; +; of the x register side-effects of puts ; +;-----------------------------------------------------; +omore .as "o more" +bottl .at " bottle" + .at "s of beer" + .at " on the wall" + .at ", " +dotnl .as "." +nline .at #13,#10 + .at "Take one down and pass it around, " +store .at "Go to the store and buy some more, " + .en +;=====================================================; +; The following is a hex dump of the object file, ; +; suitable for copying and pasting into the 6800 ; +; emulator available at swtpcemu.com! ; +;-----------------------------------------------------; +e0F00 C6 63 8D 03 3F 8D 0F CE 0F 86 86 4E 8D 0A 5A 2A +e0F10 F4 C6 63 CE 0F AA 86 6E 36 8D 38 32 36 84 6E CE +e0F20 0F 61 5D 27 15 CE 0F 67 37 86 FF C0 0A 4C 24 FB +e0F30 27 04 8B B0 8D 20 17 8B 3A 33 8D 1A C1 01 26 01 +e0F40 08 8D 10 32 81 6F 27 08 36 8D 08 32 8B 21 2A C8 +e0F50 CE 0F 85 A6 00 08 36 84 7F BD E1 D1 32 4D 2A F3 +e0F60 39 6F 20 6D 6F 72 65 20 62 6F 74 74 6C E5 73 20 +e0F70 6F 66 20 62 65 65 F2 20 6F 6E 20 74 68 65 20 77 +e0F80 61 6C EC 2C A0 2E 0D 8A 54 61 6B 65 20 6F 6E 65 +e0F90 20 64 6F 77 6E 20 61 6E 64 20 70 61 73 73 20 69 +e0FA0 74 20 61 72 6F 75 6E 64 2C A0 47 6F 20 74 6F 20 +e0FB0 74 68 65 20 73 74 6F 72 65 20 61 6E 64 20 62 75 +e0FC0 79 20 73 6F 6D 65 20 6D 6F 72 65 2C A0 +j0F00 diff --git a/Task/99-Bottles-of-Beer/ALGOL-68/99-bottles-of-beer.alg b/Task/99-Bottles-of-Beer/ALGOL-68/99-bottles-of-beer.alg new file mode 100644 index 0000000000..5ec893ef5a --- /dev/null +++ b/Task/99-Bottles-of-Beer/ALGOL-68/99-bottles-of-beer.alg @@ -0,0 +1,8 @@ +main:( + FOR bottles FROM 99 TO 1 BY -1 DO + printf(($z-d" bottles of beer on the wall"l$, bottles)); + printf(($z-d" bottles of beer"l$, bottles)); + printf(($"Take one down, pass it around"l$)); + printf(($z-d" bottles of beer on the wall"ll$, bottles-1)) + OD +) diff --git a/Task/99-Bottles-of-Beer/ATS/99-bottles-of-beer.ats b/Task/99-Bottles-of-Beer/ATS/99-bottles-of-beer.ats new file mode 100644 index 0000000000..03a0cd9943 --- /dev/null +++ b/Task/99-Bottles-of-Beer/ATS/99-bottles-of-beer.ats @@ -0,0 +1,13 @@ +/* .. is a termination metric to prove that the function terminates. It can be omitted. */ +fun bottles {n:nat} .. (n: int n): void = + if n = 0 then + () + else begin + printf ("%d bottles of beer on the wall\n", @(n)); + printf ("%d bottles of beer\n", @(n)); + printf ("Take one down, pass it around\n", @()); + printf ("%d bottles of beer on the wall\n", @(n-1)); + bottles (n - 1) + end + +implement main () = bottles (99) diff --git a/Task/99-Bottles-of-Beer/Aime/99-bottles-of-beer.aime b/Task/99-Bottles-of-Beer/Aime/99-bottles-of-beer.aime new file mode 100644 index 0000000000..47a0733c16 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Aime/99-bottles-of-beer.aime @@ -0,0 +1,20 @@ +integer +main(void) +{ + cardinal bottles; + + bottles = 99; + + do { + o_cardinal(bottles); + o_text(" bottles of beer on the wall\n"); + o_cardinal(bottles); + o_text(" bottles of beer\n"); + o_text("Take one down, pass it around\n"); + bottles -= 1; + o_cardinal(bottles); + o_text(" bottles of beer on the wall\n\n"); + } while (bottles); + + return 0; +} diff --git a/Task/99-Bottles-of-Beer/AmigaE/99-bottles-of-beer.amiga b/Task/99-Bottles-of-Beer/AmigaE/99-bottles-of-beer.amiga new file mode 100644 index 0000000000..4ca4d073cf --- /dev/null +++ b/Task/99-Bottles-of-Beer/AmigaE/99-bottles-of-beer.amiga @@ -0,0 +1,13 @@ +PROC main() + DEF t: PTR TO CHAR, + s: PTR TO CHAR, + u: PTR TO CHAR, i, x + t := 'Take one down, pass it around\n' + s := '\d bottle\s of beer\s\n' + u := ' on the wall' + FOR i := 99 TO 0 STEP -1 + ForAll({x}, [u, NIL], `WriteF(s, i, IF i <> 1 THEN 's' ELSE NIL, + x)) + IF i > 0 THEN WriteF(t) + ENDFOR +ENDPROC diff --git a/Task/99-Bottles-of-Beer/Applesoft-BASIC/99-bottles-of-beer.bas b/Task/99-Bottles-of-Beer/Applesoft-BASIC/99-bottles-of-beer.bas new file mode 100644 index 0000000000..431466059b --- /dev/null +++ b/Task/99-Bottles-of-Beer/Applesoft-BASIC/99-bottles-of-beer.bas @@ -0,0 +1,7 @@ +10 HOME +20 FOR B=99 TO 1 STEP -1 +30 PRINT B;" BOTTLE OF BEER ON THE WALL" +40 PRINT B;" BOTTLE OF BEER ON THE WALL" +50 PRINT "TAKE ONE DOWN, PASS IT AROUND" +60 PRINT B-1;" BOTTLE OF BEER ON THE WALL" +70 NEXT B diff --git a/Task/99-Bottles-of-Beer/Arbre/99-bottles-of-beer.arbre b/Task/99-Bottles-of-Beer/Arbre/99-bottles-of-beer.arbre new file mode 100644 index 0000000000..16d7cfad47 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Arbre/99-bottles-of-beer.arbre @@ -0,0 +1,22 @@ +bottle(x): + template: ' + $x bottles of beer on the wall. + $x bottles of beer. + Take one down and pass it around, + $y bottles of beer on the wall. + ' + + if x==0 + template~{x: 'No more', y: 'No more'} + else + if x==1 + template~{x: x, y: 'No more'} + else + template~{x: x, y: x-1} + +bottles(n): + for x in [n..0] + bottle(x) + +99bottles(): + bottles(99) -> io diff --git a/Task/99-Bottles-of-Beer/Argile/99-bottles-of-beer.argile b/Task/99-Bottles-of-Beer/Argile/99-bottles-of-beer.argile new file mode 100644 index 0000000000..8120785478 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Argile/99-bottles-of-beer.argile @@ -0,0 +1,19 @@ +use std + +let X be an int +for each X from 99 down to 1 + prints X bottles of beer on the wall + prints X bottles of beer + prints "Take one down, pass it" around + if X == 1 + echo No more "beer." Call da "amber lamps" + break + X-- + prints X bottles of beer on the wall "\n" + X++ + .:around :. -> text {X>59 ? "around", "to me"} + .:bottles:. -> text {X> 5 ? "bottles", (X>1 ? "buttles", "wall")} + .:of beer:. -> text {X>11 ? "of beer", "ov beeer"} + .:on the wall:. -> text { + X>17 ? "on the wall", (X>1 ? "on the bwall", "in the buttle") + } diff --git a/Task/99-Bottles-of-Beer/AutoHotkey/99-bottles-of-beer-1.ahk b/Task/99-Bottles-of-Beer/AutoHotkey/99-bottles-of-beer-1.ahk new file mode 100644 index 0000000000..de2110d039 --- /dev/null +++ b/Task/99-Bottles-of-Beer/AutoHotkey/99-bottles-of-beer-1.ahk @@ -0,0 +1,15 @@ +; RC: 99 bottles of beer + b = 99 + Loop, %b% { + s .= b . " bottles of beer on the wall,`n" + . b . " bottles of beer.`nTake one down, pass it around,`n" + . b-1 . " bottles of beer on the wall.`n`n" + b-- + } + Gui, Add, Edit, w200 h200, %s% + Gui, Show, , 99 bottles of beer +Return ; end of auto-execute section + +GuiClose: + ExitApp +Return diff --git a/Task/99-Bottles-of-Beer/AutoHotkey/99-bottles-of-beer-2.ahk b/Task/99-Bottles-of-Beer/AutoHotkey/99-bottles-of-beer-2.ahk new file mode 100644 index 0000000000..f87c7cd935 --- /dev/null +++ b/Task/99-Bottles-of-Beer/AutoHotkey/99-bottles-of-beer-2.ahk @@ -0,0 +1,17 @@ +n=99 +Gui, Font, s20 cMaroon, Comic Sans MS +Gui, Add, Text, w500 vLyrics, %n% bottles of beer on the wall... +Gui, Show +Loop { + Sleep, 2000 + GuiControl,,Lyrics,% n!=1 ? n " bottles of beer.":n " bottle of beer." + Sleep, 2000 + GuiControl,,Lyrics,% n ? "Take one down, pass it around...":"Go to the store, buy some more..." + Sleep, 2000 + n := n ? --n:99 + GuiControl,,Lyrics,% n!=1 ? n " bottles of beer on the wall.":n " bottle of beer on the wall." + Sleep, 2000 + GuiControl,,Lyrics,% n!=1 ? n " bottles of beer on the wall...":n " bottle of beer on the wall..." +} +GuiClose: +ExitApp diff --git a/Task/99-Bottles-of-Beer/AutoHotkey/99-bottles-of-beer-3.ahk b/Task/99-Bottles-of-Beer/AutoHotkey/99-bottles-of-beer-3.ahk new file mode 100644 index 0000000000..7e0b0fc58a --- /dev/null +++ b/Task/99-Bottles-of-Beer/AutoHotkey/99-bottles-of-beer-3.ahk @@ -0,0 +1,7 @@ +b=99 +Loop, %b% { +s := b " bottles of beer on the wall, " b " bottles of beer, Take one down, pass it around " b-1 " bottles of beer on the wall" +b-- +TrayTip,,%s% +sleep, 40 +} diff --git a/Task/99-Bottles-of-Beer/AutoHotkey/99-bottles-of-beer-4.ahk b/Task/99-Bottles-of-Beer/AutoHotkey/99-bottles-of-beer-4.ahk new file mode 100644 index 0000000000..24ecb70ff7 --- /dev/null +++ b/Task/99-Bottles-of-Beer/AutoHotkey/99-bottles-of-beer-4.ahk @@ -0,0 +1,10 @@ +N=o more +Z=99 +L:=Z M:=(B:=" bottle")"s" +Loop 99 +V.=L (W:=(O:=" of beer")" on the wall")",`n"L O ",`nTake one down and pass it around,`n"(L:=(--Z ? Z:"N"N)(Z=1 ? B:M))W ".`n`n" +Gui,Add,Edit,w600 h250,% V L W ", n"N M O ".`nGo to the store and buy some more, 99"M W "." +Gui,Show +Return +GuiClose: +ExitApp diff --git a/Task/99-Bottles-of-Beer/AutoIt/99-bottles-of-beer.autoit b/Task/99-Bottles-of-Beer/AutoIt/99-bottles-of-beer.autoit new file mode 100644 index 0000000000..2d8243ba91 --- /dev/null +++ b/Task/99-Bottles-of-Beer/AutoIt/99-bottles-of-beer.autoit @@ -0,0 +1,21 @@ +local $bottleNo=99 +local $lyrics=" " + +While $bottleNo<>0 + If $bottleNo=1 Then + $lyrics&=$bottleNo & " bottles of beer on the wall" & @CRLF + $lyrics&=$bottleNo & " bottles of beer" & @CRLF + $lyrics&="Take one down, pass it around" & @CRLF + Else + $lyrics&=$bottleNo & " bottles of beer on the wall" & @CRLF + $lyrics&=$bottleNo & " bottles of beer" & @CRLF + $lyrics&="Take one down, pass it around" & @CRLF + EndIf + If $bottleNo=1 Then + $lyrics&=$bottleNo-1 & " bottle of beer" & @CRLF + Else + $lyrics&=$bottleNo-1 & " bottles of beer" & @CRLF + EndIf + $bottleNo-=1 +WEnd +MsgBox(1,"99",$lyrics) diff --git a/Task/Ackermann-function/ALGOL-68/ackermann-function.alg b/Task/Ackermann-function/ALGOL-68/ackermann-function.alg new file mode 100644 index 0000000000..bf4eef6189 --- /dev/null +++ b/Task/Ackermann-function/ALGOL-68/ackermann-function.alg @@ -0,0 +1,21 @@ +PROC test ackermann = VOID: +BEGIN + PROC ackermann = (INT m, n)INT: + BEGIN + IF m = 0 THEN + n + 1 + ELIF n = 0 THEN + ackermann (m - 1, 1) + ELSE + ackermann (m - 1, ackermann (m, n - 1)) + FI + END # ackermann #; + + FOR m FROM 0 TO 3 DO + FOR n FROM 0 TO 6 DO + print(ackermann (m, n)) + OD; + new line(stand out) + OD +END # test ackermann #; +test ackermann diff --git a/Task/Ackermann-function/APL/ackermann-function.apl b/Task/Ackermann-function/APL/ackermann-function.apl new file mode 100644 index 0000000000..2a47610057 --- /dev/null +++ b/Task/Ackermann-function/APL/ackermann-function.apl @@ -0,0 +1,5 @@ +ackermann←{ + 0=1⊃⍵:1+2⊃⍵ + 0=2⊃⍵:∇(¯1+1⊃⍵)1 + ∇(¯1+1⊃⍵),∇(1⊃⍵),¯1+2⊃⍵ + } diff --git a/Task/Ackermann-function/ATS/ackermann-function.ats b/Task/Ackermann-function/ATS/ackermann-function.ats new file mode 100644 index 0000000000..05b8618446 --- /dev/null +++ b/Task/Ackermann-function/ATS/ackermann-function.ats @@ -0,0 +1,8 @@ +fun ackermann + {m,n:nat} .. + (m: int m, n: int n): Nat = + case+ (m, n) of + | (0, _) => n+1 + | (_, 0) =>> ackermann (m-1, 1) + | (_, _) =>> ackermann (m-1, ackermann (m, n-1)) +// end of [ackermann] diff --git a/Task/Ackermann-function/Argile/ackermann-function.argile b/Task/Ackermann-function/Argile/ackermann-function.argile new file mode 100644 index 0000000000..a76fee2be1 --- /dev/null +++ b/Task/Ackermann-function/Argile/ackermann-function.argile @@ -0,0 +1,10 @@ +use std + +for each (val nat n) from 0 to 6 + for each (val nat m) from 0 to 3 + print "A("m","n") = "(A m n) + +.:A :. -> nat + return (n+1) if m == 0 + return (A (m - 1) 1) if n == 0 + A (m - 1) (A m (n - 1)) diff --git a/Task/Ackermann-function/AutoHotkey/ackermann-function.ahk b/Task/Ackermann-function/AutoHotkey/ackermann-function.ahk new file mode 100644 index 0000000000..4aabb3525e --- /dev/null +++ b/Task/Ackermann-function/AutoHotkey/ackermann-function.ahk @@ -0,0 +1,11 @@ +A(m, n) { + If (m > 0) && (n = 0) + Return A(m-1,1) + Else If (m > 0) && (n > 0) + Return A(m-1,A(m, n-1)) + Else If (m=0) + Return n+1 +} + +; Example: +MsgBox, % "A(1,2) = " A(1,2) diff --git a/Task/Anagrams/AutoHotkey/anagrams.ahk b/Task/Anagrams/AutoHotkey/anagrams.ahk new file mode 100644 index 0000000000..58dc9fb03b --- /dev/null +++ b/Task/Anagrams/AutoHotkey/anagrams.ahk @@ -0,0 +1,17 @@ +MsgBox % anagrams("able") + +anagrams(word) { + Static dict + IfEqual dict,, FileRead dict, unixdict.txt ; file in the script directory + w := sort(word) + Loop Parse, dict, `n, `r + If (w = sort(A_LoopField)) + t .= A_LoopField "`n" + Return t +} + +sort(word) { + a := RegExReplace(word,".","$0`n") + Sort a + Return a +} diff --git a/Task/Arrays/ALGOL-68/arrays-1.alg b/Task/Arrays/ALGOL-68/arrays-1.alg new file mode 100644 index 0000000000..292c29921a --- /dev/null +++ b/Task/Arrays/ALGOL-68/arrays-1.alg @@ -0,0 +1,20 @@ +PROC array_test = VOID: +( + [1:20]INT a; + a := others; # assign whole array # + a[1] := -1; # assign individual element # + a[3:5] := (2, 4, -1); # assign a slice # + [1:3]INT slice = a[3:5]; # copy a slice # + + REF []INT rslice = a[3:5]; # create a reference to a slice # + print((LWB rslice, UPB slice)); # query the bounds of the slice # + rslice := (2, 4, -1); # assign to the slice, modifying original array # + + [1:3, 1:3]INT matrix; # create a two dimensional array # + REF []INT hvector = matrix[2,]; # create a reference to a row # + REF []INT vvector = matrix[,2]; # create a reference to a column # + REF [,]INT block = matrix[1:2, 1:2]; # create a reference to an area of the array # + + FLEX []CHAR string := "Hello, world!"; # create an array with variable bounds # + string := "shorter" # flexible arrays automatically resize themselves on assignment # +) diff --git a/Task/Arrays/ALGOL-68/arrays-2.alg b/Task/Arrays/ALGOL-68/arrays-2.alg new file mode 100644 index 0000000000..439a7cb94a --- /dev/null +++ b/Task/Arrays/ALGOL-68/arrays-2.alg @@ -0,0 +1,17 @@ +DEF ai[100] : ARRAY OF CHAR, -> static + da: PTR TO CHAR, + la: PTR TO CHAR + +PROC main() + da := New(100) + -> or + NEW la[100] + IF da <> NIL + ai[0] := da[0] -> first is 0 + ai[99] := da[99] -> last is "size"-1 + Dispose(da) + ENDIF + -> using NEW, we must specify the size even when + -> "deallocating" the array + IF la <> NIL THEN END la[100] +ENDPROC diff --git a/Task/Arrays/ALGOL-68/arrays-3.alg b/Task/Arrays/ALGOL-68/arrays-3.alg new file mode 100644 index 0000000000..0935326261 --- /dev/null +++ b/Task/Arrays/ALGOL-68/arrays-3.alg @@ -0,0 +1,2 @@ + set empty to {} + set ints to {1, 2, 3} diff --git a/Task/Arrays/ALGOL-68/arrays-4.alg b/Task/Arrays/ALGOL-68/arrays-4.alg new file mode 100644 index 0000000000..da6037a43c --- /dev/null +++ b/Task/Arrays/ALGOL-68/arrays-4.alg @@ -0,0 +1 @@ + set any to {1, "foo", 2.57, missing value, ints} diff --git a/Task/Arrays/Aikido/arrays.aikido b/Task/Arrays/Aikido/arrays.aikido new file mode 100644 index 0000000000..e7643d0163 --- /dev/null +++ b/Task/Arrays/Aikido/arrays.aikido @@ -0,0 +1,15 @@ +var arr1 = [1,2,3,4] // initialize with array literal +var arr2 = new [10] // empty array of 10 elements (each element has value none) +var arr3 = new int [40] // array of 40 integers +var arr4 = new Object (1,2) [10] // array of 10 instances of Object + +arr1.append (5) // add to array +var b = 4 in arr1 // check for inclusion +arr1 <<= 2 // remove first 2 elements from array +var arrx = arr1[1:3] // get slice of array +var s = arr1.size() // or sizeof(arr1) +delete arr4[2] // remove an element from an array + +var arr5 = arr1 + arr2 // append arrays +var arr6 = arr1 | arr2 // union +var arr7 = arr1 & arr2 // intersection diff --git a/Task/Arrays/Argile/arrays-1.argile b/Task/Arrays/Argile/arrays-1.argile new file mode 100644 index 0000000000..c637c37d2d --- /dev/null +++ b/Task/Arrays/Argile/arrays-1.argile @@ -0,0 +1,31 @@ +use std, array + +(::::::::::::::::: + : Static arrays : + :::::::::::::::::) +let the array of 2 text aabbArray be Cdata{"aa";"bb"} +let raw array of real :my array: = Cdata {1.0 ; 2.0 ; 3.0} (: auto sized :) +let another_array be an array of 256 byte (: not initialised :) +let (raw array of (array of 3 real)) foobar = Cdata { + {1.0; 2.0; 0.0} + {5.0; 1.0; 3.0} +} + +(: macro to get size of static arrays :) +=: .length := -> nat {size of array / (size of array[0])} +printf "%lu, %lu\n" foobar.length (another_array.length) (: 2, 256 :) + +(: access :) +another_array[255] = '&' +printf "`%c'\n" another_array[255] + + +(:::::::::::::::::: + : Dynamic arrays : + ::::::::::::::::::) +let DynArray = new array of 5 int +DynArray[0] = -42 +DynArray = (realloc DynArray (6 * size of DynArray[0])) as (type of DynArray) +DynArray[5] = 243 +prints DynArray[0] DynArray[5] +del DynArray diff --git a/Task/Arrays/Argile/arrays-2.argile b/Task/Arrays/Argile/arrays-2.argile new file mode 100644 index 0000000000..5ab2b79540 --- /dev/null +++ b/Task/Arrays/Argile/arrays-2.argile @@ -0,0 +1,4 @@ +use std, array +let x = @["foo" "bar" "123"] +print x[2] +x[2] = "abc" diff --git a/Task/Arrays/AutoHotkey/arrays-1.ahk b/Task/Arrays/AutoHotkey/arrays-1.ahk new file mode 100644 index 0000000000..f531d0bf03 --- /dev/null +++ b/Task/Arrays/AutoHotkey/arrays-1.ahk @@ -0,0 +1,7 @@ +myArray := Object() ; could use JSON-syntax sugar like {key: value} +myArray[1] := "foo" +myArray[2] := "bar" +MsgBox % myArray[2] + +; Push a value onto the array +myArray.Insert("baz") diff --git a/Task/Arrays/AutoHotkey/arrays-2.ahk b/Task/Arrays/AutoHotkey/arrays-2.ahk new file mode 100644 index 0000000000..1c982006f6 --- /dev/null +++ b/Task/Arrays/AutoHotkey/arrays-2.ahk @@ -0,0 +1,11 @@ +arrayX0 = 4 ; length +arrayX1 = first +arrayX2 = second +arrayX3 = foo +arrayX4 = bar +Loop, %arrayX0% + Msgbox % arrayX%A_Index% +source = apple bear cat dog egg fish +StringSplit arrayX, source, %A_Space% +Loop, %arrayX0% + Msgbox % arrayX%A_Index% diff --git a/Task/Arrays/AutoIt/arrays.autoit b/Task/Arrays/AutoIt/arrays.autoit new file mode 100644 index 0000000000..78893e8a04 --- /dev/null +++ b/Task/Arrays/AutoIt/arrays.autoit @@ -0,0 +1,14 @@ +#include ;Include extended Array functions (_ArrayDisplay) + +Local $aInputs[1] ;Create the Array with just 1 element + +While True ;Endless loop + $aInputs[UBound($aInputs) - 1] = InputBox("Array", "Add one value") ;Save user input to the last element of the Array + If $aInputs[UBound($aInputs) - 1] = "" Then ;If an empty string is entered, then... + ReDim $aInputs[UBound($aInputs) - 1] ;...remove them from the Array and... + ExitLoop ;... exit the loop! + EndIf + ReDim $aInputs[UBound($aInputs) + 1] ;Add an empty element to the Array +WEnd + +_ArrayDisplay($aInputs) ;Display the Array diff --git a/Task/Assertions/ALGOL-68/assertions-1.alg b/Task/Assertions/ALGOL-68/assertions-1.alg new file mode 100644 index 0000000000..f08d9368d5 --- /dev/null +++ b/Task/Assertions/ALGOL-68/assertions-1.alg @@ -0,0 +1,5 @@ +OP ASSERT = (VECTOR [] CHAR assertion,BOOL valid) VOID: +IF NOT valid +THEN type line on terminal(assertion); + terminal error( 661 {invalid assertion } ) +FI; diff --git a/Task/Assertions/ALGOL-68/assertions-2.alg b/Task/Assertions/ALGOL-68/assertions-2.alg new file mode 100644 index 0000000000..1041d5576c --- /dev/null +++ b/Task/Assertions/ALGOL-68/assertions-2.alg @@ -0,0 +1,7 @@ +PROGRAM assertions CONTEXT VOID +USE standard,environment +BEGIN + INT a := 43; + "Oops!" ASSERT ( a = 42 ) +END +FINISH diff --git a/Task/Assertions/AutoHotkey/assertions-1.ahk b/Task/Assertions/AutoHotkey/assertions-1.ahk new file mode 100644 index 0000000000..68836c1f36 --- /dev/null +++ b/Task/Assertions/AutoHotkey/assertions-1.ahk @@ -0,0 +1,8 @@ +a := 42 +Assert(a > 10) +Assert(a < 42) ; throws exception + +Assert(bool){ + If !bool + throw Exception("Expression false", -1) +} diff --git a/Task/Assertions/AutoHotkey/assertions-2.ahk b/Task/Assertions/AutoHotkey/assertions-2.ahk new file mode 100644 index 0000000000..971fd0c37c --- /dev/null +++ b/Task/Assertions/AutoHotkey/assertions-2.ahk @@ -0,0 +1,6 @@ +if (a != 42) +{ +OutputDebug, "a != 42" ; sends output to a debugger if connected +ListVars ; lists values of local and global variables +Pause ; pauses the script, use ExitApp to exit instead +} diff --git a/Task/Balanced-brackets/ANTLR/balanced-brackets.antlr b/Task/Balanced-brackets/ANTLR/balanced-brackets.antlr new file mode 100644 index 0000000000..acdf648b20 --- /dev/null +++ b/Task/Balanced-brackets/ANTLR/balanced-brackets.antlr @@ -0,0 +1,19 @@ +grammar balancedBrackets ; + +options { + language = Java; +} + +bb : {System.out.print("input is: ");} (balancedBrackets {System.out.print($balancedBrackets.text);})* NEWLINE {System.out.println();} + ; +balancedBrackets + : OpenBracket balancedBrackets* CloseBracket + ; +OpenBracket + : '[' + ; +CloseBracket + : ']' + ; +NEWLINE : '\r'? '\n' + ; diff --git a/Task/Balanced-brackets/AutoHotkey/balanced-brackets-1.ahk b/Task/Balanced-brackets/AutoHotkey/balanced-brackets-1.ahk new file mode 100644 index 0000000000..c6b36ea6b8 --- /dev/null +++ b/Task/Balanced-brackets/AutoHotkey/balanced-brackets-1.ahk @@ -0,0 +1,32 @@ +; Generate 10 strings with equal left and right brackets +Loop, 5 +{ + B = %A_Index% + loop 2 + { + String = + Loop % B + String .= "[`n" + Loop % B + String .= "]`n" + Sort, String, Random + StringReplace, String, String,`n,,All + Example .= String " - " IsBalanced(String) "`n" + } +} + MsgBox % Example +return + +IsBalanced(Str) +{ + Loop, PARSE, Str + { + If A_LoopField = [ + i++ + Else if A_LoopField = ] + i-- + If i < 0 + return "NOT OK" + } + Return "OK" +} diff --git a/Task/Balanced-brackets/AutoHotkey/balanced-brackets-2.ahk b/Task/Balanced-brackets/AutoHotkey/balanced-brackets-2.ahk new file mode 100644 index 0000000000..7f8956d317 --- /dev/null +++ b/Task/Balanced-brackets/AutoHotkey/balanced-brackets-2.ahk @@ -0,0 +1,23 @@ +Loop, 5 +{ + B = %A_Index% + loop 2 + { + String = + Loop % B + String .= "[`n" + Loop % B + String .= "]`n" + Sort, String, Random + StringReplace, String, String,`n,,All + Example .= String " - " IsBalanced(String) "`n" + } +} + MsgBox % Example +return + +IsBalanced(Str){ + While (Instr(Str,"[]")) + StringReplace, Str, Str,[],,All + Return Str ? "False" : "True" +} diff --git a/Task/Balanced-brackets/AutoIt/balanced-brackets.autoit b/Task/Balanced-brackets/AutoIt/balanced-brackets.autoit new file mode 100644 index 0000000000..040cd311e6 --- /dev/null +++ b/Task/Balanced-brackets/AutoIt/balanced-brackets.autoit @@ -0,0 +1,28 @@ +#include +Local $Array[1] +_ArrayAdd($Array, "[]") +_ArrayAdd($Array, "[][]") +_ArrayAdd($Array, "[[][]]") +_ArrayAdd($Array, "][") +_ArrayAdd($Array, "][][") +_ArrayAdd($Array, "[]][[]") + +For $i = 0 To UBound($Array) -1 + Balanced_Brackets($Array[$i]) + If @error Then + ConsoleWrite($Array[$i] &" = NOT OK"&@CRLF) + Else + ConsoleWrite($Array[$i] &" = OK"&@CRLF) + EndIf +Next + +Func Balanced_Brackets($String) + Local $cnt = 0 + $Split = Stringsplit($String, "") + For $i = 1 To $Split[0] + If $split[$i] = "[" Then $cnt += 1 + If $split[$i] = "]" Then $cnt -= 1 + If $cnt < 0 Then Return SetError(1,0,0) + Next + Return 1 +EndFunc diff --git a/Task/Best-shuffle/AutoHotkey/best-shuffle.ahk b/Task/Best-shuffle/AutoHotkey/best-shuffle.ahk new file mode 100644 index 0000000000..5a017dd7f3 --- /dev/null +++ b/Task/Best-shuffle/AutoHotkey/best-shuffle.ahk @@ -0,0 +1,52 @@ +words := "abracadabra,seesaw,elk,grrrrrr,up,a" +Loop Parse, Words,`, + out .= Score(A_LoopField, Shuffle(A_LoopField)) +MsgBox % clipboard := out + + +Shuffle(String) +{ + Cord := String + Length := StrLen(String) + CharType := A_IsUnicode ? "UShort" : "UChar" + + Loop, Parse, String ; For each old character in String... + { + Char1 := SubStr(Cord, A_Index, 1) + If (Char1 <> A_LoopField) ; If new character already differs, + Continue ; do nothing. + + Index1 := A_Index + OldChar1 := A_LoopField + Random, Index2, 1, Length ; Starting at some random index, + Loop, %Length% ; for each index... + { + If (Index1 <> Index2) ; Swap requires two different indexes. + { + Char2 := SubStr(Cord, Index2, 1) + OldChar2 := SubStr(String, Index2, 1) + + ; If after the swap, the two new characters would differ from + ; the two old characters, then do the swap. + If (Char1 <> OldChar2) and (Char2 <> OldChar1) + { + ; Swap Char1 and Char2 inside Cord. + NumPut(Asc(Char1), Cord, (Index2 - 1) << !!A_IsUnicode, CharType) + NumPut(Asc(Char2), Cord, (Index1 - 1) << !!A_IsUnicode, CharType) + Break + } + } + Index2 += 1 ; Get next index. + If (Index2 > Length) ; If after last index, + Index2 := 1 ; use first index. + } + } + Return Cord +} +Score(a, b){ + r := 0 + Loop Parse, a + If (A_LoopField = SubStr(b, A_Index, 1)) + r++ + return a ", " b ", (" r ")`n" +} diff --git a/Task/Binary-search/ALGOL-68/binary-search.alg b/Task/Binary-search/ALGOL-68/binary-search.alg new file mode 100644 index 0000000000..dd29797746 --- /dev/null +++ b/Task/Binary-search/ALGOL-68/binary-search.alg @@ -0,0 +1,47 @@ +MODE ELEMENT = STRING; + +# Iterative: # +PROC iterative binary search = ([]ELEMENT hay stack, ELEMENT needle)INT: ( + INT out, + low := LWB hay stack, + high := UPB hay stack; + WHILE low < high DO + INT mid := (low+high) OVER 2; + IF hay stack[mid] > needle THEN high := mid-1 + ELIF hay stack[mid] < needle THEN low := mid+1 + ELSE out:= mid; stop iteration FI + OD; + low EXIT + stop iteration: + out + +# Recursive: # +PROC recursive binary search = ([]ELEMENT hay stack, ELEMENT needle)INT: ( + IF LWB hay stack > UPB hay stack THEN + LWB hay stack + ELIF LWB hay stack = UPB hay stack THEN + IF hay stack[LWB hay stack] = needle THEN LWB hay stack + ELSE LWB hay stack FI + ELSE + INT mid := (LWB hay stack+UPB hay stack) OVER 2; + IF hay stack[mid] > needle THEN recursive binary search(hay stack[:mid-1], needle) + ELIF hay stack[mid] < needle THEN mid + recursive binary search(hay stack[mid+1:], needle) + ELSE mid FI + FI +); +# Test cases: # +test:( + ELEMENT needle = "mister"; + []ELEMENT hay stack = ("AA","Maestro","Mario","Master","Mattress","Mister","Mistress","ZZ"), + test cases = ("A","Master","Monk","ZZZ"); + + PROC test search = (PROC([]ELEMENT, ELEMENT)INT search, []ELEMENT test cases)VOID: + FOR case TO UPB test cases DO + ELEMENT needle = test cases[case]; + INT index = search(hay stack, needle); + BOOL found = ( index <= 0 | FALSE | hay stack[index]=needle); + printf(($""""g""" "b("FOUND at","near")" index "dl$, needle, found, index)) + OD; + test search(iterative binary search, test cases); + test search(recursive binary search, test cases) +) diff --git a/Task/Binary-search/AutoHotkey/binary-search.ahk b/Task/Binary-search/AutoHotkey/binary-search.ahk new file mode 100644 index 0000000000..c27979f27b --- /dev/null +++ b/Task/Binary-search/AutoHotkey/binary-search.ahk @@ -0,0 +1,33 @@ +array := "1,2,4,6,8,9" +StringSplit, A, array, `, ; creates associative array +MsgBox % x := BinarySearch(A, 4, 1, A0) ; Recursive +MsgBox % A%x% +MsgBox % x := BinarySearchI(A, A0, 4) ; Iterative +MsgBox % A%x% + +BinarySearch(A, value, low, high) { ; A0 contains length of array + If (high < low) ; A1, A2, A3...An are array elements + Return not_found + mid := Floor((low + high) / 2) + If (A%mid% > value) ; A%mid% is automatically global since no such locals are present + Return BinarySearch(A, value, low, mid - 1) + Else If (A%mid% < value) + Return BinarySearch(A, value, mid + 1, high) + Else + Return mid +} + +BinarySearchI(A, lengthA, value) { + low := 0 + high := lengthA - 1 + While (low <= high) { + mid := Floor((low + high) / 2) ; round to lower integer + If (A%mid% > value) + high := mid - 1 + Else If (A%mid% < value) + low := mid + 1 + Else + Return mid + } + Return not_found +} diff --git a/Task/Binary-strings/ALGOL-68/binary-strings.alg b/Task/Binary-strings/ALGOL-68/binary-strings.alg new file mode 100644 index 0000000000..b799db1e59 --- /dev/null +++ b/Task/Binary-strings/ALGOL-68/binary-strings.alg @@ -0,0 +1,93 @@ +# String creation # +STRING a,b,c,d,e,f,g,h,i,j,l,r; +a := "hello world"; +print((a, new line)); + +# String destruction (for garbage collection) # +b := (); +BEGIN + LOC STRING lb := "hello earth"; # allocate off the LOC stack # + HEAP STRING hb := "hello moon"; # allocate out of the HEAP space # + ~ +END; # local variable "lb" has LOC stack space recovered at END # + +# String assignment # +c := "a"+REPR 0+"b"; +print (("string length c:", UPB c, new line));# ==> 3 # + +# String comparison # +l := "ab"; r := "CD"; + +BOOL result; +FORMAT summary = $""""g""" is "b("","NOT ")"lexicographically "g" """g""""l$ ; + +result := l < r OR l LT r; printf((summary, l, result, "less than", r)); +result := l <= r OR l LE r # OR l ≤ r #; printf((summary, l, result, "less than or equal to", r)); +result := l = r OR l EQ r; printf((summary, l, result, "equal to", r)); +result := l /= r OR l NE r # OR l ≠ r #; printf((summary, l, result, "not equal to", r)); +result := l >= r OR l GE r # OR l ≥ r #; printf((summary, l, result, "greater than or equal to", r)); +result := l > r OR l GT r; printf((summary, l, result, "greater than", r)); + +# String cloning and copying # +e := f; + +# Check if a string is empty # +IF g = "" THEN print(("g is empty", new line)) FI; +IF UPB g = 0 THEN print(("g is empty", new line)) FI; + +# Append a byte to a string # +h +:= "A"; + +# Append a string to a string # +h +:= "BCD"; +h PLUSAB "EFG"; + +# Prepend a string to a string - because STRING addition isn't communitive # +"789" +=: h; +"456" PLUSTO h; +print(("The result of prepends and appends: ", h, new line)); + +# Extract a substring from a string # +i := h[2:3]; +print(("Substring 2:3 of ",h," is ",i, new line)); + +# Replace every occurrences of a byte (or a string) in a string with another string # +PROC replace = (STRING string, old, new, INT count)STRING: ( + INT pos; + STRING tail := string, out; + TO count WHILE string in string(old, pos, tail) DO + out +:= tail[:pos-1]+new; + tail := tail[pos+UPB old:] + OD; + out+tail +); + +j := replace("hello world", "world", "planet", max int); +print(("After replace string: ", j, new line)); + +INT offset = 7; +# Replace a character at an offset in the string # +j[offset] := "P"; +print(("After replace 7th character: ", j, new line)); + +# Replace a substring at an offset in the string # +j[offset:offset+3] := "PlAN"; +print(("After replace 7:10th characters: ", j, new line)); + +# Insert a string before an offset in the string # +j := j[:offset-1]+"INSERTED "+j[offset:]; +print(("Insert string before 7th character: ", j, new line)); + +# Join strings # +a := "hel"; +b := "lo w"; +c := "orld"; +d := a+b+c; + +print(("a+b+c is ",d, new line)); + +# Pack a string into the target CPU's word # +BYTES word := bytes pack(d); + +# Extract a CHAR from a CPU word # +print(("7th byte in CPU word is: ", offset ELEM word, new line)) diff --git a/Task/Bulls-and-cows/ALGOL-68/bulls-and-cows.alg b/Task/Bulls-and-cows/ALGOL-68/bulls-and-cows.alg new file mode 100644 index 0000000000..8aa1956d37 --- /dev/null +++ b/Task/Bulls-and-cows/ALGOL-68/bulls-and-cows.alg @@ -0,0 +1,55 @@ +STRING digits = "123456789"; + +[4]CHAR chosen; +STRING available := digits; +FOR i TO UPB chosen DO + INT c = ENTIER(random*UPB available)+1; + chosen[i] := available[c]; + available := available[:c-1]+available[c+1:] +OD; + +COMMENT print((chosen, new line)); # Debug # END COMMENT + +OP D = (INT d)STRING: whole(d,0); # for formatting an integer # + +print (("I have chosen a number from ",D UPB chosen," unique digits from 1 to 9 arranged in a random order.", new line, +"You need to input a ",D UPB chosen," digit, unique digit number as a guess at what I have chosen", new line)); + +PRIO WITHIN = 5, NOTWITHIN = 5; +OP WITHIN = (CHAR c, []CHAR s)BOOL: char in string(c,LOC INT,s); +OP NOTWITHIN = (CHAR c, []CHAR s)BOOL: NOT ( c WITHIN s ); + +INT guesses := 0, bulls, cows; +WHILE + STRING guess; + guesses +:= 1; + WHILE + # get a good guess # + print((new line,"Next guess [",D guesses,"]: ")); + read((guess, new line)); + IF UPB guess NE UPB chosen THEN + FALSE + ELSE + BOOL ok; + FOR i TO UPB guess WHILE + ok := guess[i] WITHIN digits AND guess[i] NOTWITHIN guess[i+1:] + DO SKIP OD; + NOT ok + FI + DO + print(("Problem, try again. You need to enter ",D UPB chosen," unique digits from 1 to 9", new line)) + OD; +# WHILE # + guess NE chosen +DO + bulls := cows := 0; + FOR i TO UPB chosen DO + IF guess[i] = chosen[i] THEN + bulls +:= 1 + ELIF guess[i] WITHIN chosen THEN + cows +:= 1 + FI + OD; + print((" ",D bulls," Bulls",new line," ",D cows," Cows")) +OD; +print((new line, "Congratulations you guessed correctly in ",D guesses," attempts.",new line)) diff --git a/Task/Bulls-and-cows/AutoHotkey/bulls-and-cows.ahk b/Task/Bulls-and-cows/AutoHotkey/bulls-and-cows.ahk new file mode 100644 index 0000000000..11d432c501 --- /dev/null +++ b/Task/Bulls-and-cows/AutoHotkey/bulls-and-cows.ahk @@ -0,0 +1,28 @@ +While StrLen(Code) < 4 { + Random, num, 1, 9 + If !InStr(Code, num) + Code .= num +} +Gui, Add, Edit, vGuess, Enter a guess... +Gui, Add, Button, wp Default, Submit +Gui, Add, ListBox, ym r8 vHistory +Gui, Show +Return + +ButtonSubmit: + Gui, Submit, NoHide + If StrLen(Guess) != 4 + Return + If Guess is not digit + Return + bulls:=0, cows:=0 + Loop, 4 + If (SubStr(Guess, A_Index, 1) = SubStr(Code, A_Index, 1)) + bulls++ + Else If InStr(Code, SubStr(Guess, A_Index, 1)) + cows++ + GuiControl,, History, % Guess ": " bulls " Bulls " cows " Cows" +Return + +GuiClose: + ExitApp diff --git a/Task/Caesar-cipher/ALGOL-68/caesar-cipher.alg b/Task/Caesar-cipher/ALGOL-68/caesar-cipher.alg new file mode 100644 index 0000000000..b9875470e3 --- /dev/null +++ b/Task/Caesar-cipher/ALGOL-68/caesar-cipher.alg @@ -0,0 +1,43 @@ +#!/usr/local/bin/a68g --script # + +program caesar: BEGIN + + MODE MODXXVI = SHORT SHORT INT; # MOD26 # + + PROC to m26 = (CHAR c, offset)MODXXVI: + BEGIN + ABS c - ABS offset + END #to m26#; + + PROC to char = (MODXXVI value, CHAR offset)CHAR: + BEGIN + REPR ( ABS offset + value MOD 26 ) + END #to char#; + + PROC encrypt = (STRING plain, MODXXVI key)STRING: + BEGIN + [UPB plain]CHAR ciph; + FOR i TO UPB plain DO + CHAR c = plain[i]; + ciph[i]:= + IF "A" <= c AND c <= "Z" THEN + to char(to m26(c, "A")+key, "A") + ELIF "a" <= c AND c <= "z" THEN + to char(to m26(c, "a")+key, "a") + ELSE + c + FI + OD; + ciph + END #encrypt#; + +# caesar main program # + STRING text := "The five boxing wizards jump quickly" # OR read string #; + MODXXVI key := 3; # Default key from "Bello Gallico" # + + printf(($gl$, "Plaintext ------------>" + text)); + text := encrypt(text, key); + printf(($gl$, "Ciphertext ----------->" + text)); + printf(($gl$, "Decrypted Ciphertext ->" + encrypt(text, -key))) + +END #caesar# diff --git a/Task/Caesar-cipher/AutoHotkey/caesar-cipher-1.ahk b/Task/Caesar-cipher/AutoHotkey/caesar-cipher-1.ahk new file mode 100644 index 0000000000..7112172185 --- /dev/null +++ b/Task/Caesar-cipher/AutoHotkey/caesar-cipher-1.ahk @@ -0,0 +1,6 @@ +n=2 +s=HI +t:=&s +While *t +o.=Chr(Mod(*t-65+n,26)+65),t+=2 +MsgBox % o diff --git a/Task/Caesar-cipher/AutoHotkey/caesar-cipher-2.ahk b/Task/Caesar-cipher/AutoHotkey/caesar-cipher-2.ahk new file mode 100644 index 0000000000..f1ee9d5a1d --- /dev/null +++ b/Task/Caesar-cipher/AutoHotkey/caesar-cipher-2.ahk @@ -0,0 +1,13 @@ +Caesar(string, n){ + Loop Parse, string + { + If (Asc(A_LoopField) >= Asc("A") and Asc(A_LoopField) <= Asc("Z")) + out .= Chr(Mod(Asc(A_LoopField)-Asc("A")+n,26)+Asc("A")) + Else If (Asc(A_LoopField) >= Asc("a") and Asc(A_LoopField) <= Asc("z")) + out .= Chr(Mod(Asc(A_LoopField)-Asc("a")+n,26)+Asc("a")) + Else out .= A_LoopField + } + return out +} + +MsgBox % Caesar("h i", 2) "`n" Caesar("Hi", 20) diff --git a/Task/Caesar-cipher/AutoIt/caesar-cipher.autoit b/Task/Caesar-cipher/AutoIt/caesar-cipher.autoit new file mode 100644 index 0000000000..c10d78e8b2 --- /dev/null +++ b/Task/Caesar-cipher/AutoIt/caesar-cipher.autoit @@ -0,0 +1,32 @@ +$Caesar = Caesar("Hi", 2, True) +MsgBox(0, "Caesar", $Caesar) +Func Caesar($String, $int, $encrypt = True) + If Not IsNumber($int) Or Not StringIsDigit($int) Then Return SetError(1, 0, 0) + If $int < 1 Or $int > 25 Then Return SetError(2, 0, 0) + Local $sLetters, $x + $String = StringUpper($String) + $split = StringSplit($String, "") + For $i = 1 To $split[0] + If Asc($split[$i]) - 64 > 26 Or Asc($split[$i]) - 64 < 1 Then + $sLetters &= $split[$i] + ContinueLoop + EndIf + If $encrypt = True Then + $move = Asc($split[$i]) - 64 + $int + Else + $move = Asc($split[$i]) - 64 - $int + EndIf + If $move > 26 Then + $move -= 26 + ElseIf $move < 1 Then + $move += 26 + EndIf + While $move + $x = Mod($move, 26) + If $x = 0 Then $x = 26 + $sLetters &= Chr($x + 64) + $move = ($move - $x) / 26 + WEnd + Next + Return $sLetters +EndFunc ;==>Caesar diff --git a/Task/Calendar/ALGOL-68/calendar.alg b/Task/Calendar/ALGOL-68/calendar.alg new file mode 100644 index 0000000000..3a050c2e8b --- /dev/null +++ b/Task/Calendar/ALGOL-68/calendar.alg @@ -0,0 +1,108 @@ +#!/usr/local/bin/a68g --script # + +PROC print calendar = (INT year, page width)VOID: ( + + []STRING month names = ( + "January","February","March","April","May","June", + "July","August","September","October","November","December"), + weekday names = ("Su","Mo","Tu","We","Th","Fr","Sa"); + FORMAT weekday fmt = $g,n(UPB weekday names - LWB weekday names)(" "g)$; + + # Juggle the calendar format to fit the printer/screen width # + INT day width = UPB weekday names[1], day gap=1; + INT month width = (day width+day gap) * UPB weekday names-1; + INT month heading lines = 2; + INT month lines = (31 OVER UPB weekday names+month heading lines+2); # +2 for head/tail weeks # + INT year cols = (page width+1) OVER (month width+1); + INT year rows = (UPB month names-1)OVER year cols + 1; + INT month gap = (page width - year cols*month width + 1)OVER year cols; + INT year width = year cols*(month width+month gap)-month gap; + INT year lines = year rows*month lines; + + MODE MONTHBOX = [month lines, month width]CHAR; + MODE YEARBOX = [year lines, year width]CHAR; + + INT week start = 1; # Sunday # + + PROC days in month = (INT year, month)INT: + CASE month IN 31, + IF year MOD 4 EQ 0 AND year MOD 100 NE 0 OR year MOD 400 EQ 0 THEN 29 ELSE 28 FI, + 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 + ESAC; + + PROC day of week = (INT year, month, day)INT: ( + # Day of the week by Zeller’s Congruence algorithm from 1887 # + INT y := year, m := month, d := day, c; + IF m <= 2 THEN m +:= 12; y -:= 1 FI; + c := y OVER 100; + y %*:= 100; + (d - 1 + ((m + 1) * 26) OVER 10 + y + y OVER 4 + c OVER 4 - 2 * c) MOD 7 + ); + + MODE SIMPLEOUT = UNION(STRING, []STRING, INT); + + PROC cputf = (REF[]CHAR out, FORMAT fmt, SIMPLEOUT argv)VOID:( + FILE f; STRING s; associate(f,s); + putf(f, (fmt, argv)); + out[:UPB s]:=s; + close(f) + ); + + PROC month repr = (INT year, month)MONTHBOX:( + MONTHBOX month box; FOR line TO UPB month box DO month box[line,]:=" "* 2 UPB month box OD; + STRING month name = month names[month]; + + # center the title # + cputf(month box[1,(month width - UPB month name ) OVER 2+1:], $g$, month name); + cputf(month box[2,], weekday fmt, weekday names); + + INT first day := day of week(year, month, 1); + FOR day TO days in month(year, month) DO + INT line = (day+first day-week start) OVER UPB weekday names + month heading lines + 1; + INT char =((day+first day-week start) MOD UPB weekday names)*(day width+day gap) + 1; + cputf(month box[line,char:char+day width-1],$g(-day width)$, day) + OD; + month box + ); + + PROC year repr = (INT year)YEARBOX:( + YEARBOX year box; + FOR line TO UPB year box DO year box[line,]:=" "* 2 UPB year box OD; + FOR month row FROM 0 TO year rows-1 DO + FOR month col FROM 0 TO year cols-1 DO + INT month = month row * year cols + month col + 1; + IF month > UPB month names THEN + done + ELSE + INT month col width = month width+month gap; + year box[ + month row*month lines+1 : (month row+1)*month lines, + month col*month col width+1 : (month col+1)*month col width-month gap + ] := month repr(year, month) + FI + OD + OD; + done: year box + ); + + INT center = (year cols*(month width+month gap) - month gap - 1) OVER 2; + INT indent = (page width - year width) OVER 2; + + printf(( + $n(indent + center - 9)k g l$, "[Insert Snoopy here]", + $n(indent + center - 1)k 4d l$, year, $l$, + $n(indent)k n(year width)(g) l$, year repr(year) + )) +); + +main: ( +CO inspired by http://www.ee.ryerson.ca/~elf/hack/realmen.html + Real Programmers Don't Use PASCAL - Ed Post + Datamation, volume 29 number 7, July 1983 + THE REAL PROGRAMMER'S NATURAL HABITAT +"Taped to the wall is a line-printer Snoopy calender for the year 1969." +CO + INT mankind stepped on the moon = 1969, + line printer width = 80; # as at 1969! # + print calendar(mankind stepped on the moon, line printer width) +) diff --git a/Task/Check-that-file-exists/Aikido/check-that-file-exists.aikido b/Task/Check-that-file-exists/Aikido/check-that-file-exists.aikido new file mode 100644 index 0000000000..aa1b40deea --- /dev/null +++ b/Task/Check-that-file-exists/Aikido/check-that-file-exists.aikido @@ -0,0 +1,8 @@ +function exists (filename) { + return stat (filename) != null +} + +exists ("input.txt") +exists ("/input.txt") +exists ("docs") +exists ("/docs") diff --git a/Task/Check-that-file-exists/AutoHotkey/check-that-file-exists.ahk b/Task/Check-that-file-exists/AutoHotkey/check-that-file-exists.ahk new file mode 100644 index 0000000000..a46099925f --- /dev/null +++ b/Task/Check-that-file-exists/AutoHotkey/check-that-file-exists.ahk @@ -0,0 +1,33 @@ +; FileExist() function examples +ShowFileExist("input.txt") +ShowFileExist("\input.txt") +ShowFolderExist("docs") +ShowFolderExist("\docs") + +; IfExist/IfNotExist command examples (from documentation) +IfExist, D:\ + MsgBox, The drive exists. +IfExist, D:\Docs\*.txt + MsgBox, At least one .txt file exists. +IfNotExist, C:\Temp\FlagFile.txt + MsgBox, The target file does not exist. + +Return + +ShowFileExist(file) +{ + If (FileExist(file) && !InStr(FileExist(file), "D")) + MsgBox, file: %file% exists. + Else + MsgBox, file: %file% does NOT exist. + Return +} + +ShowFolderExist(folder) +{ + If InStr(FileExist(folder), "D") + MsgBox, folder: %folder% exists. + Else + MsgBox, folder: %folder% does NOT exist. + Return +} diff --git a/Task/Classes/ALGOL-68/classes.alg b/Task/Classes/ALGOL-68/classes.alg new file mode 100644 index 0000000000..7410278d95 --- /dev/null +++ b/Task/Classes/ALGOL-68/classes.alg @@ -0,0 +1,82 @@ +MODE MYDATA = STRUCT( + INT name1 +); +STRUCT( + INT name2, + PROC (REF MYDATA)REF MYDATA new, + PROC (REF MYDATA)VOID init, + PROC (REF MYDATA)VOID some method +) class my data; +class my data := ( + # name2 := # 2, # Class attribute # + + # PROC new := # (REF MYDATA new)REF MYDATA:( + (init OF class my data)(new); + new + ), + + # PROC init := # (REF MYDATA self)VOID:( + """ Constructor (Technically an initializer rather than a true 'constructor') """; + name1 OF self := 0 # Instance attribute # + ), + + # PROC some method := # (REF MYDATA self)VOID:( + """ Method """; + name1 OF self := 1; + name2 OF class my data := 3 + ) +); + +# class name, invoked as a function is the constructor syntax # +REF MYDATA my data = (new OF class my data)(LOC MYDATA); + +MODE GENDEROPT = UNION(STRING, VOID); +MODE AGEOPT = UNION(INT, VOID); + +MODE MYOTHERDATA = STRUCT( + STRING name, + GENDEROPT gender, + AGEOPT age +); +STRUCT ( + INT count, + PROC (REF MYOTHERDATA, STRING, GENDEROPT, AGEOPT)REF MYOTHERDATA new, + PROC (REF MYOTHERDATA, STRING, GENDEROPT, AGEOPT)VOID init, + PROC (REF MYOTHERDATA)VOID del +) class my other data; +class my other data := ( + # count := # 0, # Population of "(init OF class my other data)" objects # +# PROC new := # (REF MYOTHERDATA new, STRING name, GENDEROPT gender, AGEOPT age)REF MYOTHERDATA:( + (init OF class my other data)(new, name, gender, age); + new + ), + + # PROC init := # (REF MYOTHERDATA self, STRING name, GENDEROPT gender, AGEOPT age)VOID:( + """ One initializer required, others are optional (with different defaults) """; + count OF class my other data +:= 1; + name OF self := name; + gender OF self := gender; + CASE gender OF self IN + (VOID):gender OF self := "Male" + ESAC; + age OF self := age + ), + + # PROC del := # (REF MYOTHERDATA self)VOID:( + count OF class my other data -:= 1 + ) +); + +PROC attribute error := STRING: error char; # mend the error with the "error char" # + +# Allocate the instance from HEAP # +REF MYOTHERDATA person1 = (new OF class my other data)(HEAP MYOTHERDATA, "John", EMPTY, EMPTY); +print (((name OF person1), ": ", + (gender OF person1|(STRING gender):gender|attribute error), " ")); # "John Male" # +print (((age OF person1|(INT age):age|attribute error), new line)); # Raises AttributeError exception! # + +# Allocate the instance from LOC (stack) # +REF MYOTHERDATA person2 = (new OF class my other data)(LOC MYOTHERDATA, "Jane", "Female", 23); +print (((name OF person2), ": ", + (gender OF person2|(STRING gender):gender|attribute error), " ")); +print (((age OF person2|(INT age):age|attribute error), new line)) # "Jane Female 23" # diff --git a/Task/Classes/Aikido/classes.aikido b/Task/Classes/Aikido/classes.aikido new file mode 100644 index 0000000000..386eec649e --- /dev/null +++ b/Task/Classes/Aikido/classes.aikido @@ -0,0 +1,7 @@ +class Circle (radius, x, y) extends Shape (x, y) implements Drawable { + var myvec = new Vector (x, y) + + public function draw() { + // draw the circle + } +} diff --git a/Task/Classes/AmigaE/classes.amiga b/Task/Classes/AmigaE/classes.amiga new file mode 100644 index 0000000000..eba668ccfa --- /dev/null +++ b/Task/Classes/AmigaE/classes.amiga @@ -0,0 +1,27 @@ +OBJECT a_class + varA, varP +ENDOBJECT + +-> this could be used like a constructor +PROC init() OF a_class + self.varP := 10 + self.varA := 2 +ENDPROC + +-> the special proc end() is for destructor +PROC end() OF a_class +-> nothing to do here... +ENDPROC + +-> a not so useful getter +PROC getP() OF a_class IS self.varP + +PROC main() + DEF obj : PTR TO a_class + NEW obj.init() + WriteF('\d\n', obj.varA) -> this can be done, while + -> varP can't be accessed directly + WriteF('\d\n', obj.varP) -> or + WriteF('\d\n', obj.getP()) + END obj +ENDPROC diff --git a/Task/Classes/AutoHotkey/classes.ahk b/Task/Classes/AutoHotkey/classes.ahk new file mode 100644 index 0000000000..ec9766e2c7 --- /dev/null +++ b/Task/Classes/AutoHotkey/classes.ahk @@ -0,0 +1,19 @@ +obj := new MyClass +obj.WhenCreated() + +class MyClass { +; Instance Variable #1 + time := A_Hour ":" A_Min ":" A_Sec + +; Constructor + __New() { + MsgBox, % "Constructing new object of type: " this.__Class + FormatTime, date, , MM/dd/yyyy + ; Instance Variable #2 + this.date := date + } +; Method + WhenCreated() { + MsgBox, % "Object created at " this.time " on " this.date + } +} diff --git a/Task/Collections/AutoHotkey/collections-1.ahk b/Task/Collections/AutoHotkey/collections-1.ahk new file mode 100644 index 0000000000..91f62bd1e9 --- /dev/null +++ b/Task/Collections/AutoHotkey/collections-1.ahk @@ -0,0 +1,4 @@ +myCol := Object() +mycol.mykey := "my value!" +mycol["mykey"] := "new val!" +MsgBox % mycol.mykey ; new val diff --git a/Task/Collections/AutoHotkey/collections-2.ahk b/Task/Collections/AutoHotkey/collections-2.ahk new file mode 100644 index 0000000000..37a194afe4 --- /dev/null +++ b/Task/Collections/AutoHotkey/collections-2.ahk @@ -0,0 +1,3 @@ +Loop 3 + array%A_Index% := A_Index * 9 +MsgBox % array1 " " array2 " " array3 ; 9 18 27 diff --git a/Task/Collections/AutoHotkey/collections-3.ahk b/Task/Collections/AutoHotkey/collections-3.ahk new file mode 100644 index 0000000000..4dd8a85cee --- /dev/null +++ b/Task/Collections/AutoHotkey/collections-3.ahk @@ -0,0 +1,4 @@ +VarSetCapacity(Rect, 16) ; A RECT is a struct consisting of four 32-bit integers (i.e. 4*4=16). +DllCall("GetWindowRect", UInt, WinExist(), UInt, &Rect) ; WinExist() returns an HWND. +MsgBox % "Left " . NumGet(Rect, 0, true) . " Top " . NumGet(Rect, 4, true) + . " Right " . NumGet(Rect, 8, true) . " Bottom " . NumGet(Rect, 12, true) diff --git a/Task/Color-of-a-screen-pixel/Applesoft-BASIC/color-of-a-screen-pixel-1.bas b/Task/Color-of-a-screen-pixel/Applesoft-BASIC/color-of-a-screen-pixel-1.bas new file mode 100644 index 0000000000..484a9c0728 --- /dev/null +++ b/Task/Color-of-a-screen-pixel/Applesoft-BASIC/color-of-a-screen-pixel-1.bas @@ -0,0 +1,3 @@ +X = PDL (0) * 5 / 32 +Y = PDL (1) * 3 / 16 + COLOR= SCRN( X,Y) diff --git a/Task/Color-of-a-screen-pixel/Applesoft-BASIC/color-of-a-screen-pixel-2.bas b/Task/Color-of-a-screen-pixel/Applesoft-BASIC/color-of-a-screen-pixel-2.bas new file mode 100644 index 0000000000..535fca91da --- /dev/null +++ b/Task/Color-of-a-screen-pixel/Applesoft-BASIC/color-of-a-screen-pixel-2.bas @@ -0,0 +1,41 @@ + 100 REM GET HCOLOR + 110 REM PARAMETERS: X Y + 120 REM RETURNS: C + 130 REM + 140 P = 0:X = X + 1 + 150 ON (X < 280) GOSUB 300 + 160 PR = P:P = 0:X = X - 2 + 170 ON (X > = 0) GOSUB 300 + 180 PL = P:X = X + 1: GOSUB 300 + 190 ODD = X - INT (X / 2) * 2 + 200 C = H * 4 + 210 IF NOT ((PL = PR) AND (PL < > P)) THEN C = C + P * 3: RETURN + 220 IF ODD THEN P = NOT P + 230 C = C + P + 1 + 240 RETURN + 250 REM + 260 REM GET PIXEL + 270 REM PARAMETERS: X Y + 280 REM RETURNS: H P + 290 REM + 300 H = INT (X / 7) + 310 V = INT (Y / 8) + 320 VO = PEEK (37) + 330 HO = PEEK (36) + 340 VTAB V + 1: HTAB 1 + 350 A = PEEK (41) * 256 + 360 A = A + PEEK (40) + H + 370 VTAB VO + 1: HTAB HO + 1 + 380 A = A + 8192 - 1024 + 390 P = PEEK (230) / 32 + 400 IF P = 2 THEN A = A + 8192 + 410 A = A + (Y - V * 8) * 1024 + 420 B = X - H * 7 + 430 V = PEEK (A) + 440 H = INT (V / 128) + 450 V = INT (V / (2 ^ B)) + 460 P = V - INT (V / 2) * 2 + 470 RETURN + +X = 267 : Y = 166 : GOSUB 100 +HCOLOR= C diff --git a/Task/Color-of-a-screen-pixel/AutoHotkey/color-of-a-screen-pixel.ahk b/Task/Color-of-a-screen-pixel/AutoHotkey/color-of-a-screen-pixel.ahk new file mode 100644 index 0000000000..5fd98b81c6 --- /dev/null +++ b/Task/Color-of-a-screen-pixel/AutoHotkey/color-of-a-screen-pixel.ahk @@ -0,0 +1 @@ +PixelGetColor, color, %X%, %Y% diff --git a/Task/Color-of-a-screen-pixel/AutoIt/color-of-a-screen-pixel.autoit b/Task/Color-of-a-screen-pixel/AutoIt/color-of-a-screen-pixel.autoit new file mode 100644 index 0000000000..3f1b1556ff --- /dev/null +++ b/Task/Color-of-a-screen-pixel/AutoIt/color-of-a-screen-pixel.autoit @@ -0,0 +1,2 @@ +$a = Mousegetpos() +PixelGetColor($a[0], $a[1]) diff --git a/Task/Comments/6502-Assembly/comments.6502 b/Task/Comments/6502-Assembly/comments.6502 new file mode 100644 index 0000000000..73bee9d8c4 --- /dev/null +++ b/Task/Comments/6502-Assembly/comments.6502 @@ -0,0 +1 @@ + nop ; comments begin with a semicolon diff --git a/Task/Comments/8086-Assembly/comments.8086 b/Task/Comments/8086-Assembly/comments.8086 new file mode 100644 index 0000000000..ae6b0ecefb --- /dev/null +++ b/Task/Comments/8086-Assembly/comments.8086 @@ -0,0 +1,2 @@ + MOV AX, 4C00h ; go back to DOS + INT 21h ; BIOS interrupt 21 base 16 diff --git a/Task/Comments/AmigaE/comments.amiga b/Task/Comments/AmigaE/comments.amiga new file mode 100644 index 0000000000..e586b85406 --- /dev/null +++ b/Task/Comments/AmigaE/comments.amiga @@ -0,0 +1,3 @@ +/* multiline comment +are like C ... */ +-> this is a end of line comment diff --git a/Task/Comments/AutoHotkey/comments.ahk b/Task/Comments/AutoHotkey/comments.ahk new file mode 100644 index 0000000000..23aff2d369 --- /dev/null +++ b/Task/Comments/AutoHotkey/comments.ahk @@ -0,0 +1,5 @@ +Msgbox, comments demo ; end of line comment +/* +multiline comment1 +multiline comment2 +*/ diff --git a/Task/Comments/AutoIt/comments.autoit b/Task/Comments/AutoIt/comments.autoit new file mode 100644 index 0000000000..260be4b084 --- /dev/null +++ b/Task/Comments/AutoIt/comments.autoit @@ -0,0 +1,5 @@ +#cs +Everything between the cs and and the ce is commented. +Commented code is not used by the computer. +#ce +;individual lines after a semicolon are commented. diff --git a/Task/Define-a-primitive-data-type/ALGOL-68/define-a-primitive-data-type.alg b/Task/Define-a-primitive-data-type/ALGOL-68/define-a-primitive-data-type.alg new file mode 100644 index 0000000000..2ee9d7ad00 --- /dev/null +++ b/Task/Define-a-primitive-data-type/ALGOL-68/define-a-primitive-data-type.alg @@ -0,0 +1,161 @@ + # assume max int <= ABS - max negative int # + INT max bounded = ( LENG max int * max int > long max int | ENTIER sqrt(max int) | max int ); + + MODE RANGE = STRUCT(INT lwb, upb); + MODE BOUNDED = STRUCT(INT value, RANGE range); + FORMAT bounded repr = $g"["g(-0)":"g(-0)"]"$; + + # Define some useful operators for looping over ranges # + OP LWB = (RANGE range)INT: lwb OF range, + UPB = (RANGE range)INT: upb OF range, + LWB = (BOUNDED bounded)INT: lwb OF range OF bounded, + UPB = (BOUNDED bounded)INT: upb OF range OF bounded; + + PROC raise exception = ([]STRING args)VOID: ( + put(stand error, ("exception: ",args, newline)); + stop + ); + + PROC raise not implemented error := ([]STRING args)VOID: raise exception(args); + PROC raise bounds error := ([]STRING args)VOID: raise exception(args); + + PRIO MIN=9, MAX=9; + OP MIN = ([]INT list)INT: ( + INT out:= list[LWB list]; + FOR index FROM LWB list+1 TO UPB list DO IF list[index]out THEN out :=list[index] FI OD; + out + ); + + PRIO ASSERTIN = 6; + OP ASSERTIN = (INT result, []RANGE range)BOUNDED: ( + BOUNDED out = (result, (MAX lwb OF range, MIN upb OF range)); + IF value OF out < lwb OF range OF out THEN + raise bounds error(("out of bounds", whole(result, int width)," < [",whole(MAX lwb OF range, int width),":]")) + ELIF value OF out > upb OF range OF out THEN + raise bounds error(("out of bounds", whole(result, int width)," > [:",whole(MIN upb OF range, int width),"]")) + FI; + out + ), + ASSERTIN = (LONG INT result, []RANGE range)BOUNDED: ( + STRUCT (LONG INT value, RANGE range) out = (result, (MAX lwb OF range, MIN upb OF range)); + IF value OF out < lwb OF range OF out THEN + raise bounds error(("out of bounds", whole(result, long int width)," < [",whole(MAX lwb OF range, int width),":]")) + ELIF value OF out > upb OF range OF out THEN + raise bounds error(("out of bounds", whole(result, long int width)," > [:",whole(MIN upb OF range, int width),"]")) + FI; + (SHORTEN value OF out, range OF out) + ), + ASSERTIN = (INT result, []BOUNDED bounds)BOUNDED: result ASSERTIN range OF bounds, + ASSERTIN = (LONG INT result, []BOUNDED bounds)BOUNDED: result ASSERTIN range OF bounds; + + INT half max int = max int OVER 2; + INT sqrt max int = ENTIER sqrt (max int); + + OP + = (BOUNDED a, b)BOUNDED: + IF ABS value OF a < half max int AND ABS value OF b < half max int THEN + value OF a + value OF b ASSERTIN []BOUNDED(a,b) + ELSE + LENG value OF a + value OF b ASSERTIN []BOUNDED(a,b) + FI, + - = (BOUNDED a, b)BOUNDED: value OF a + -value OF b ASSERTIN []BOUNDED(a,b), + * = (BOUNDED a, b)BOUNDED: + IF ABS value OF a < sqrt max int AND ABS value OF b < sqrt max int THEN + value OF a * value OF b ASSERTIN []BOUNDED(a,b) + ELSE + LENG value OF a * value OF b ASSERTIN []BOUNDED(a,b) + FI, + / = (BOUNDED a, b)REAL: value OF a / value OF b, + % = (BOUNDED a, b)BOUNDED: value OF a % value OF b ASSERTIN []BOUNDED(a,b), + %* = (BOUNDED a, b)BOUNDED: value OF a %* value OF b ASSERTIN []BOUNDED(a,b), + ** = (BOUNDED a, INT exponent)BOUNDED: value OF a ** exponent ASSERTIN []BOUNDED(a); + + OP OVER = (INT value, RANGE range)BOUNDED: + IF ABS lwb OF range > max bounded THEN + raise bounds error(("out of bounds, ABS", whole(lwb OF range, int width)," > [:",whole(max bounded, int width),"]")); + SKIP + ELIF ABS upb OF range > max bounded THEN + raise bounds error(("out of bounds, ABS", whole(upb OF range, int width)," > [:",whole(max bounded, int width),"]")); + SKIP + ELSE + value ASSERTIN []RANGE(range) + FI; + + OP INTINIT = (BOUNDED range)REAL: value OF range; + + OP < = (BOUNDED a, b)BOOL: value OF a < value OF b, + > = (BOUNDED a, b)BOOL: value OF a > value OF b, + <= = (BOUNDED a, b)BOOL: NOT ( value OF a > value OF b ), + >= = (BOUNDED a, b)BOOL: NOT ( value OF a < value OF b ), + = = (BOUNDED a, b)BOOL: value OF a = value OF b, + /= = (BOUNDED a, b)BOOL: NOT (a = b); + + # Monadic operators # + OP - = (BOUNDED range)BOUNDED: -value OF range ASSERTIN []BOUNDED(range), + ABS = (BOUNDED range)BOUNDED: ABS value OF range ASSERTIN []BOUNDED(range); + + COMMENT Operators for extended characters set, and increment/decrement: + OP +:= = (REF BOUNDED a, BOUNDED b)REF BOUNDED: ( a := a + b ), + +=: = (BOUNDED a, REF BOUNDED b)REF BOUNDED: ( b := a + b ), + -:= = (REF BOUNDED a, BOUNDED b)REF BOUNDED: ( a := a - b ), + *:= = (REF BOUNDED a, BOUNDED b)REF BOUNDED: ( a := a * b ), + %:= = (REF BOUNDED a, BOUNDED b)REF BOUNDED: ( a := a % b ), + %*:= = (REF BOUNDED a, BOUNDED b)REF BOUNDED: ( a := a %* b ); + + # OP aliases for extended character sets (eg: Unicode, APL, ALCOR and GOST 10859) # + OP × = (BOUNDED a, b)BOUNDED: a * b, + ÷ = (BOUNDED a, b)INT: a OVER b, + ÷× = (BOUNDED a, b)BOUNDED: a MOD b, + ÷* = (BOUNDED a, b)BOUNDED: a MOD b, + %× = (BOUNDED a, b)BOUNDED: a MOD b, + ≤ = (BOUNDED a, b)BOUNDED: a <= b, + ≥ = (BOUNDED a, b)BOUNDED: a >= b, + ≠ = (BOUNDED a, b)BOOL: a /= b, + ↑ = (BOUNDED range, INT exponent)BOUNDED: value OF range ** exponent, + + ÷×:= = (REF BOUNDED a, BOUNDED b)REF BOUNDED: ( a := a MOD b ), + %×:= = (REF BOUNDED a, BOUNDED b)REF BOUNDED: ( a := a MOD b ), + ÷*:= = (REF BOUNDED a, BOUNDED b)REF BOUNDED: ( a := a MOD b ); + + # BOLD aliases for CPU that only support uppercase for 6-bit bytes - wrist watches # + OP OVER = (BOUNDED a, b)INT: a % b, + MOD = (BOUNDED a, b)BOUNDED: a %*b, + LT = (BOUNDED a, b)BOOL: a < b, + GT = (BOUNDED a, b)BOOL: a > b, + LE = (BOUNDED a, b)BOOL: a <= b, + GE = (BOUNDED a, b)BOOL: a >= b, + EQ = (BOUNDED a, b)BOOL: a = b, + NE = (BOUNDED a, b)BOOL: a /= b, + UP = (BOUNDED range, INT exponent)BOUNDED: range**exponent; + + # the required standard assignment operators # + OP PLUSAB = (REF BOUNDED a, BOUNDED b)REF BOUNDED: ( a +:= b ), # PLUS # + PLUSTO = (BOUNDED a, REF BOUNDED b)REF BOUNDED: ( a +=: b ), # PRUS # + MINUSAB = (REF BOUNDED a, BOUNDED b)REF BOUNDED: ( a *:= b ), + DIVAB = (REF BOUNDED a, BOUNDED b)REF BOUNDED: ( a /:= b ), + OVERAB = (REF BOUNDED a, BOUNDED b)REF BOUNDED: ( a %:= b ), + MODAB = (REF BOUNDED a, BOUNDED b)REF BOUNDED: ( a %*:= b ); + +END COMMENT +Test: + RANGE range = RANGE(0, 10000); + + # override the default exception # + raise bounds error := ([]STRING args)VOID: ( + putf(stand error, ($g$, args, $"- exiting to except bounds error"l$)); + except bounds error + ); + + BOUNDED a, b := 0 OVER range; + FOR step FROM 4 BY 4 TO UPB range DO # something for pythagoras # + b := b + step OVER range; + a := ENTIER sqrt( 1.5 + 2 * value OF b ) OVER range OF b; + printf(($"Sum of "$, bounded repr, a * a, b * b, + $" is "$, bounded repr, a * a + b * b, $l$)) + OD; + except bounds error: + SKIP diff --git a/Task/Delegates/Aikido/delegates.aikido b/Task/Delegates/Aikido/delegates.aikido new file mode 100644 index 0000000000..e32d411efc --- /dev/null +++ b/Task/Delegates/Aikido/delegates.aikido @@ -0,0 +1,23 @@ +class Delegator { + public generic delegate = none + + public function operation { + if (typeof(delegate) == "none") { + return "default implementation" + } + return delegate() + } +} + +function thing { + return "delegate implementation" +} + +// default, no delegate +var d = new Delegator() +println (d.operation()) + +// delegate +var d1 = new Delegator() +d1.delegate = thing +println (d1.operation()) diff --git a/Task/Delete-a-file/ALGOL-68/delete-a-file.alg b/Task/Delete-a-file/ALGOL-68/delete-a-file.alg new file mode 100644 index 0000000000..58650dca3c --- /dev/null +++ b/Task/Delete-a-file/ALGOL-68/delete-a-file.alg @@ -0,0 +1,17 @@ +main:( + PROC remove = (STRING file name)INT: + BEGIN + FILE actual file; + INT errno = open(actual file, file name, stand back channel); + IF errno NE 0 THEN stop remove FI; + scratch(actual file); # detach the book and burn it # + errno + EXIT + stop remove: + errno + END; + remove("input.txt"); + remove("/input.txt"); + remove("docs"); + remove("/docs") +) diff --git a/Task/Delete-a-file/Aikido/delete-a-file.aikido b/Task/Delete-a-file/Aikido/delete-a-file.aikido new file mode 100644 index 0000000000..3455ca3265 --- /dev/null +++ b/Task/Delete-a-file/Aikido/delete-a-file.aikido @@ -0,0 +1,4 @@ +remove ("input.txt") +remove ("/input.txt") +remove ("docs") +remove ("/docs") diff --git a/Task/Delete-a-file/AutoHotkey/delete-a-file.ahk b/Task/Delete-a-file/AutoHotkey/delete-a-file.ahk new file mode 100644 index 0000000000..b32816042c --- /dev/null +++ b/Task/Delete-a-file/AutoHotkey/delete-a-file.ahk @@ -0,0 +1,4 @@ +FileDelete, input.txt +FileDelete, \input.txt +FileRemoveDir, docs, 1 +FileRemoveDir, \docs, 1 diff --git a/Task/Detect-division-by-zero/ALGOL-68/detect-division-by-zero.alg b/Task/Detect-division-by-zero/ALGOL-68/detect-division-by-zero.alg new file mode 100644 index 0000000000..a966cb781f --- /dev/null +++ b/Task/Detect-division-by-zero/ALGOL-68/detect-division-by-zero.alg @@ -0,0 +1,26 @@ +PROC raise exception= ([]STRING args)VOID: ( + put(stand error, ("Exception: ",args, newline)); + stop +); + +PROC raise zero division error := VOID: + raise exception("integer division or modulo by zero"); + +PROC int div = (INT a,b)REAL: a/b; +PROC int over = (INT a,b)INT: a%b; +PROC int mod = (INT a,b)INT: a%*b; + +BEGIN + OP / = (INT a,b)REAL: ( b = 0 | raise zero division error; SKIP | int div (a,b) ); + OP % = (INT a,b)INT: ( b = 0 | raise zero division error; SKIP | int over(a,b) ); + OP %* = (INT a,b)INT: ( b = 0 | raise zero division error; SKIP | int mod (a,b) ); + + PROC a different handler = VOID: ( + put(stand error,("caught division by zero",new line)); + stop + ); + + INT x:=1, y:=0; + raise zero division error := a different handler; + print(x/y) +END diff --git a/Task/Detect-division-by-zero/Applesoft-BASIC/detect-division-by-zero.bas b/Task/Detect-division-by-zero/Applesoft-BASIC/detect-division-by-zero.bas new file mode 100644 index 0000000000..556e9b99ed --- /dev/null +++ b/Task/Detect-division-by-zero/Applesoft-BASIC/detect-division-by-zero.bas @@ -0,0 +1,10 @@ + 100 REM TRY + 110 ONERR GOTO 200 + 120 D = - 44 / 0 + 190 END + 200 REM CATCH + 210 E = PEEK (222) < > 133 + 220 POKE 216,0: REM ONERR OFF + 230 IF E THEN RESUME + 240 CALL - 3288: REM RECOVER + 250 PRINT "DIVISION BY ZERO" diff --git a/Task/Detect-division-by-zero/AutoHotkey/detect-division-by-zero.ahk b/Task/Detect-division-by-zero/AutoHotkey/detect-division-by-zero.ahk new file mode 100644 index 0000000000..6139efd8c1 --- /dev/null +++ b/Task/Detect-division-by-zero/AutoHotkey/detect-division-by-zero.ahk @@ -0,0 +1,8 @@ +ZeroDiv(num1, num2) { + If ((num1/num2) != "") + MsgBox % num1/num2 + Else + MsgBox, 48, Warning, The result is not valid (Divide By Zero). +} +ZeroDiv(0, 3) ; is ok +ZeroDiv(3, 0) ; divize by zero alert diff --git a/Task/Determine-if-a-string-is-numeric/ALGOL-68/determine-if-a-string-is-numeric.alg b/Task/Determine-if-a-string-is-numeric/ALGOL-68/determine-if-a-string-is-numeric.alg new file mode 100644 index 0000000000..b858821b08 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/ALGOL-68/determine-if-a-string-is-numeric.alg @@ -0,0 +1,26 @@ +PROC is numeric = (REF STRING string) BOOL: ( + BOOL out := TRUE; + PROC call back false = (REF FILE f)BOOL: (out:= FALSE; TRUE); + + FILE memory; + associate(memory, string); + on value error(memory, call back false); + on logical file end(memory, call back false); + + UNION (INT, REAL, COMPL) numeric:=0.0; + # use a FORMAT pattern instead of a regular expression # + getf(memory, ($gl$, numeric)); + out +); + +test:( + STRING + s1 := "152", + s2 := "-3.1415926", + s3 := "Foo123"; + print(( + s1, " results in ", is numeric(s1), new line, + s2, " results in ", is numeric(s2), new line, + s3, " results in ", is numeric(s3), new line + )) +) diff --git a/Task/Determine-if-a-string-is-numeric/APL/determine-if-a-string-is-numeric.apl b/Task/Determine-if-a-string-is-numeric/APL/determine-if-a-string-is-numeric.apl new file mode 100644 index 0000000000..ef8694cbb9 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/APL/determine-if-a-string-is-numeric.apl @@ -0,0 +1,2 @@ + ⊃⎕VFI{w←⍵⋄((w='-')/w)←'¯'⋄w}'152 -3.1415926 Foo123' +1 1 0 diff --git a/Task/Determine-if-a-string-is-numeric/AutoHotkey/determine-if-a-string-is-numeric.ahk b/Task/Determine-if-a-string-is-numeric/AutoHotkey/determine-if-a-string-is-numeric.ahk new file mode 100644 index 0000000000..24179b97b7 --- /dev/null +++ b/Task/Determine-if-a-string-is-numeric/AutoHotkey/determine-if-a-string-is-numeric.ahk @@ -0,0 +1,12 @@ +list = 0 .14 -5.2 ten 0xf +Loop, Parse, list, %A_Space% + MsgBox,% IsNumeric(A_LoopField) +Return + +IsNumeric(x) { + If x is number + Return, 1 + Else Return, 0 +} + +;Output: 1 1 1 0 1 diff --git a/Task/FizzBuzz/6502-Assembly/fizzbuzz.6502 b/Task/FizzBuzz/6502-Assembly/fizzbuzz.6502 new file mode 100644 index 0000000000..e3037f0885 --- /dev/null +++ b/Task/FizzBuzz/6502-Assembly/fizzbuzz.6502 @@ -0,0 +1,79 @@ + .lf fzbz6502.lst + .cr 6502 + .tf fzbz6502.obj,ap1 +;------------------------------------------------------ +; FizzBuzz for the 6502 by barrym95838 2013.04.04 +; Thanks to sbprojects.com for a very nice assembler! +; The target for this assembly is an Apple II with +; mixed-case output capabilities and Applesoft +; BASIC in ROM (or language card) +; Tested and verified on AppleWin 1.20.0.0 +;------------------------------------------------------ +; Constant Section +; +FizzCt = 3 Fizz Counter (must be < 255) +BuzzCt = 5 Buzz Counter (must be < 255) +Lower = 1 Loop start value (must be 1) +Upper = 100 Loop end value (must be < 255) +CharOut = $fded Specific to the Apple II +IntOut = $ed24 Specific to ROM Applesoft +;====================================================== + .or $0f00 +;------------------------------------------------------ +; The main program +; +main ldx #Lower init LoopCt + lda #FizzCt + sta Fizz init FizzCt + lda #BuzzCt + sta Buzz init BuzzCt +next ldy #0 reset string pointer (y) + dec Fizz LoopCt mod FizzCt == 0? + bne noFizz yes: + lda #FizzCt + sta Fizz restore FizzCt + ldy #sFizz-str point y to "Fizz" + jsr puts output "Fizz" +noFizz dec Buzz LoopCt mod BuzzCt == 0? + bne noBuzz yes: + lda #BuzzCt + sta Buzz restore BuzzCt + ldy #sBuzz-str point y to "Buzz" + jsr puts output "Buzz" +noBuzz dey any output yet this cycle? + bpl noInt no: + txa save LoopCt + pha + lda #0 set up regs for IntOut + jsr IntOut output itoa(LoopCt) + pla + tax restore LoopCt +noInt ldy #sNL-str + jsr puts output "\n" + inx increment LoopCt + cpx #Upper+1 LoopCt >= Upper+1? + bcc next no: loop back + rts yes: end main +;------------------------------------------------------ +; Output zero-terminated string @ (str+y) +; (Entry point is puts, not outch) +; +outch jsr CharOut output string char + iny advance string ptr +puts lda str,y get a string char + bne outch output and loop if non-zero + rts return +;------------------------------------------------------ +; String literals (in '+128' ascii, Apple II style) +; +str: ; string base offset +sFizz .az -"Fizz" +sBuzz .az -"Buzz" +sNL .az -#13 +;------------------------------------------------------ +; Variable Section +; +Fizz .da #0 +Buzz .da #0 +;------------------------------------------------------ + .en diff --git a/Task/FizzBuzz/8086-Assembly/fizzbuzz.8086 b/Task/FizzBuzz/8086-Assembly/fizzbuzz.8086 new file mode 100644 index 0000000000..c41f2fb723 --- /dev/null +++ b/Task/FizzBuzz/8086-Assembly/fizzbuzz.8086 @@ -0,0 +1,88 @@ + ; Init the registers +mov dx,03030h ; For easier printing, the number is + ;kept in Binary Coded Decimal, in +---- + + ;the DX register. +mov ah,0Eh ; 0Eh is the IBM PC interrupt 10h + ;function that does write text on + ;the screen in teletype mode. +mov bl,100d ; BL is the counter (100 numbers). +xor cx,cx ; CX is a counter that will be used + ;for screen printing. +xor bh,bh ; BH is the counter for counting + ;multiples of three. + +writeloop: ; Increment the BCD number in DX. +inc dl ; Increment the low digit +cmp dl,3Ah ; If it does not overflow nine, +jnz writeloop1 ;continue with the program, +mov dl,30h ;otherwise reset it to zero and +inc dh ;increment the high digit +writeloop1: +inc bh ; Increment the BH counter. +cmp bh,03h ; If it reached three, we did + ;increment the number three times + ;from the last time the number was + ;a multiple of three, so the number + ;is now a multiple of three now, +jz writefizz ;then we need to write "fizz" on the + ;screen. +cmp dl,30h ; The number isn't a multiple of +jz writebuzz ;three, so we check if it's a +cmp dl,35h ;multiple of five. If it is, we +jz writebuzz ;need to write "buzz". The program + ;checks if the last digit is zero or + ;five. +mov al,dh ; If we're here, there's no need to +int 10h ;write neither "fizz" nor "buzz", so +mov al,dl ;the program writes the BCD number +int 10h ;in DX +writespace: +mov al,020h ;and a white space. +int 10h +dec bl ; Loop if we didn't process 100 +jnz writeloop ;numbers. + +programend: ; When we did reach 100 numbers, +cli ;the program flow falls here, where +hlt ;interrupts are cleared and the +jmp programend ;program is stopped. + +writefizz: ; There's need to write "fizz": +mov si,offset fizz ; SI points to the "fizz" string, +call write ;that is written on the screen. +xor bh,bh ; BH, the counter for computing the + ;multiples of three, is cleared. +cmp dl,30h ; We did write "fizz", but, if the +jz writebuzz ;number is a multiple of five, we +cmp dl,35h ;could need to write "buzz" also: +jnz writespace ;check if the number is multiple of + ;five. If not, write a space and + ;return to the main loop. +writebuzz: ; (The above code falls here if + ;the last digit is five, otherwise + ;it jumps) +mov si,offset buzz ;SI points to the "buzz" string, +call write ;that is written on the screen. +jmp writespace ; Write a space to return to the main + ;loop. + +write: ; Write subroutine: +mov cl,04h ; Set CX to the lenght of the string: + ;both strings are 4 bytes long. +write1: +mov al,[si] ; Load the character to write in AL. +inc si ; Increment the counter SI. +int 10h ; Call interrupt 10h, function 0Eh to + ;write the character and advance the + ;text cursor (teletype mode) +loop write1 ; Decrement CX: if CX is not zero, do +ret ;loop, otherwise return from + ;subroutine. + +fizz: ;The "fizz" string. +db "fizz" + +buzz: ;The "buzz" string. +db "buzz" diff --git a/Task/FizzBuzz/ALGOL-68/fizzbuzz-1.alg b/Task/FizzBuzz/ALGOL-68/fizzbuzz-1.alg new file mode 100644 index 0000000000..1e829ca458 --- /dev/null +++ b/Task/FizzBuzz/ALGOL-68/fizzbuzz-1.alg @@ -0,0 +1,15 @@ +main:( + FOR i TO 100 DO + printf(($gl$, + IF i %* 15 = 0 THEN + "FizzBuzz" + ELIF i %* 3 = 0 THEN + "Fizz" + ELIF i %* 5 = 0 THEN + "Buzz" + ELSE + i + FI + )) + OD +) diff --git a/Task/FizzBuzz/ALGOL-68/fizzbuzz-2.alg b/Task/FizzBuzz/ALGOL-68/fizzbuzz-2.alg new file mode 100644 index 0000000000..1abc6b7180 --- /dev/null +++ b/Task/FizzBuzz/ALGOL-68/fizzbuzz-2.alg @@ -0,0 +1 @@ +FOR i TO 100 DO print(((i%*15=0|"FizzBuzz"|:i%*3=0|"Fizz"|:i%*5=0|"Buzz"|i),new line)) OD diff --git a/Task/FizzBuzz/APL/fizzbuzz.apl b/Task/FizzBuzz/APL/fizzbuzz.apl new file mode 100644 index 0000000000..9c4c983cb1 --- /dev/null +++ b/Task/FizzBuzz/APL/fizzbuzz.apl @@ -0,0 +1,2 @@ +⎕IO←0 +(L,'Fizz' 'Buzz' 'FizzBuzz')[¯1+(L×W=0)+W←(100×~0=W)+W←⊃+/1 2×0=3 5|⊂L←1+⍳100] diff --git a/Task/FizzBuzz/AppleScript/fizzbuzz.applescript b/Task/FizzBuzz/AppleScript/fizzbuzz.applescript new file mode 100644 index 0000000000..404a7a6ee9 --- /dev/null +++ b/Task/FizzBuzz/AppleScript/fizzbuzz.applescript @@ -0,0 +1,14 @@ +property outputText: "" +repeat with i from 1 to 100 + if i mod 15 = 0 then + set outputText to outputText & "FizzBuzz" + else if i mod 3 = 0 then + set outputText to outputText & "Fizz" + else if i mod 5 = 0 then + set outputText to outputText & "Buzz" + else + set outputText to outputText & i + end if + set outputText to outputText & linefeed +end repeat +outputText diff --git a/Task/FizzBuzz/Arbre/fizzbuzz.arbre b/Task/FizzBuzz/Arbre/fizzbuzz.arbre new file mode 100644 index 0000000000..5c14a93077 --- /dev/null +++ b/Task/FizzBuzz/Arbre/fizzbuzz.arbre @@ -0,0 +1,15 @@ +fizzbuzz(): + for x in [1..100] + if x%5==0 and x%3==0 + return "FizzBuzz" + else + if x%3==0 + return "Fizz" + else + if x%5==0 + return "Buzz" + else + return x + +main(): + fizzbuzz() -> io diff --git a/Task/FizzBuzz/AutoHotkey/fizzbuzz-1.ahk b/Task/FizzBuzz/AutoHotkey/fizzbuzz-1.ahk new file mode 100644 index 0000000000..d8ff14b937 --- /dev/null +++ b/Task/FizzBuzz/AutoHotkey/fizzbuzz-1.ahk @@ -0,0 +1,14 @@ +Loop, 100 +{ + If (Mod(A_Index, 15) = 0) + output .= "FizzBuzz`n" + Else If (Mod(A_Index, 3) = 0) + output .= "Fizz`n" + Else If (Mod(A_Index, 5) = 0) + output .= "Buzz`n" + Else + output .= A_Index "`n" +} +FileDelete, output.txt +FileAppend, %output%, output.txt +Run, cmd /k type output.txt diff --git a/Task/FizzBuzz/AutoHotkey/fizzbuzz-2.ahk b/Task/FizzBuzz/AutoHotkey/fizzbuzz-2.ahk new file mode 100644 index 0000000000..b4367d0961 --- /dev/null +++ b/Task/FizzBuzz/AutoHotkey/fizzbuzz-2.ahk @@ -0,0 +1,7 @@ +Gui, Add, Edit, r20 +Gui,Show +Loop, 100 + Send, % (!Mod(A_Index, 15) ? "FizzBuzz" : !Mod(A_Index, 3) ? "Fizz" : !Mod(A_Index, 5) ? "Buzz" : A_Index) "`n" +Return +Esc:: +ExitApp diff --git a/Task/FizzBuzz/AutoIt/fizzbuzz.autoit b/Task/FizzBuzz/AutoIt/fizzbuzz.autoit new file mode 100644 index 0000000000..c1a9bc06ec --- /dev/null +++ b/Task/FizzBuzz/AutoIt/fizzbuzz.autoit @@ -0,0 +1,11 @@ +For $i = 1 To 100 + If Mod($i, 15) = 0 Then + MsgBox(0, "FizzBuzz", "FizzBuzz") + ElseIf Mod($i, 5) = 0 Then + MsgBox(0, "FizzBuzz", "Buzz") + ElseIf Mod($i, 3) = 0 Then + MsgBox(0, "FizzBuzz", "Fizz") + Else + MsgBox(0, "FizzBuzz", $i) + EndIf +Next diff --git a/Task/Forest-fire/6502-Assembly/forest-fire.6502 b/Task/Forest-fire/6502-Assembly/forest-fire.6502 new file mode 100644 index 0000000000..91e9a15a37 --- /dev/null +++ b/Task/Forest-fire/6502-Assembly/forest-fire.6502 @@ -0,0 +1,420 @@ + ORG $4357 +; SYS 17239 or CALL 17239 + +EMPTY2 = $00 +TREE2 = $44 +FIRE2 = $99 + +; common available zero page + + +GBASL = $26 +GBASH = $27 + +SEED2 = $28 +SEED0 = $29 +SEED1 = $2A + +H2 = $2B +V2 = $2C +PLOTC = $2D +COLOR = $2E +PAGE = $2F +TOPL = $30 +TOPH = $31 +MIDL = $32 +MIDH = $33 +BTML = $34 +BTMH = $35 +PLOTL = $36 +PLOTH = $37 +lastzp = $38 + +tablelo = $5000 +tablehi = tablelo+25 + + JSR START + STA V2 + LDA #$4C ; JMP instruction + STA SEED2 ; temporary JMP + LDX #$00 ; y coord +table: + TXA + JSR SEED2 ; temporary JMP GBASCALC + LDA GBASL + STA tablelo,X + LDA GBASH + STA tablehi,X + LDY #$00 + TYA +clrline: + STA (GBASL),Y + INY + CPY #40 + BNE clrline + + INX + CPX V2 + BNE table + + JSR sseed0 + JSR sseed2 + + LDX #$60 + STX PAGE + STX TOPH + LDY #$00 + STY TOPL + TYA +zero: STA (TOPL),Y + INY + BNE zero + INX + STX TOPH + CPX #$80 + BNE zero + +loop3: + LDX #0 + STX TOPL + LDA #41 + STA MIDL + STA PLOTL + LDA #83 + STA BTML + LDA PAGE + STA TOPH + STA MIDH + STA BTMH + EOR #$10 + STA PLOTH + STA PAGE +loop2: + TXA + STX V2 + LSR ; F800 PLOT-like... + ; PHP ; F801 + TAY ; save A in Y without touching C + LDA #$0F + BCC over2 + ADC #$E0 +over2: STA PLOTC ; PLOT... + LDA tablelo,Y ; lookup instead of GBASCALC + STA GBASL + LDA tablehi,Y + STA GBASH + ; PLP ; continue PLOT + LDY #$01 ; x coord +loop1: + STY H2 + LDA (MIDL),Y + STA (PLOTL),Y + BEQ empty + BPL tree + LDA #EMPTY2 +doplot: LDY H2 + STA (PLOTL),Y + DEY + EOR (GBASL),Y + AND PLOTC + EOR (GBASL),Y + STA (GBASL),Y +noplot: + LDY H2 + INY + CPY #41 + BNE loop1 + LDA MIDL + STA TOPL + LDA MIDH + STA TOPH + LDA BTML + STA MIDL + STA PLOTL + CLC + ADC #42 + STA BTML + LDA BTMH + EOR #$10 + STA PLOTH + EOR #$10 + STA MIDH + ADC #$00 + STA BTMH + LDX V2 + INX + CPX #48 + BNE loop2 + JSR QUIT + JMP loop3 +empty: + DEC SEED2 + BNE noplot + JSR sseed2 ; probability f + LDA #TREE2 + BNE doplot +ignite: + LDA #FIRE2 + BNE doplot +tree: + DEC SEED0 + BNE check + DEC SEED1 + BNE check + JSR sseed0 ; probability p + BNE ignite +check: + LDA (TOPL),Y ; n + ORA (BTML),Y ; s + DEY + ORA (TOPL),Y ; nw + ORA (MIDL),Y ; w + ORA (BTML),Y ; sw + INY + INY + ORA (TOPL),Y ; ne + ORA (MIDL),Y ; e + ORA (BTML),Y ; se + BMI ignite + BPL noplot + +sseed0: + LDA #$17 ; 1 in 10007 (prime) + STA SEED0 + LDA #$27 + STA SEED1 + RTS +sseed2: + LDA #$65 ; 1 in 101 (prime) + STA SEED2 + RTS + +default: + LDA #GBASCALC + STA SEED1 + LDA #25 ; screen rows + RTS +GBASCALC: + LDY #$00 + STY GBASH + ASL + ASL + ASL + STA GBASL + ASL + ROL GBASH + ASL + ROL GBASH + ADC GBASL + STA GBASL + LDA GBASH + ADC #$04 + STA GBASH + RTS + +QUIT: + LDA $E000 + +; APPLE II + + CMP #$4C + BNE c64quit + + BIT $C000 ; apple ii keypress? + BPL CONTINUE ; no keypressed then continue + BIT $C010 ; clear keyboard strobe + BIT $C051 ; text mode + +; end APPLE II specific + +ABORT: + PLA + PLA + + LDX #GBASL +restorzp: + LDA $5100,X + STA $00,X + INX + CPX #lastzp + BNE restorzp + +CONTINUE: + RTS + +START: + LDX #GBASL +savezp: + LDA $00,X + STA $5100,X + INX + CPX #lastzp + BNE savezp + +; machine ??? + + LDA $E000 ; terribly unreliable, oh well + +; APPLE II + + CMP #$4C ; apple ii? + BNE c64start ; nope, try another + + BIT $C056 ; low resolution + BIT $C052 ; full screen + BIT $C054 ; page one + BIT $C050 ; graphics +; GBASCALC = $F847 + LDA #$47 + STA SEED0 + LDA #$F8 + STA SEED1 + LDA #24 ; screen rows + RTS + +; end APPLE II specific + +; COMMODORE 64 specific + +c64quit: + +; COMMODORE 64 + + CMP #$85 ; commodore 64? + BNE CONTINUE ; nope, default to no keypress + + LDA $C6 ; commodore keyboard buffer length + BEQ CONTINUE ; no keypressed then continue + + LDA #$00 + STA $C6 + LDA $D016 ; Screen control register #2 + AND #$EF ; Bit #4: 0 = Multicolor mode off. + STA $D016 + LDA #21 ; default character set + STA $D018 + BNE ABORT + +c64start: + + CMP #$85 ; commodore 64? + BEQ c64yes ; yes + JMP default ; no, default to boringness +c64yes: + LDA #$00 ; black + STA $D020 ; border + LDA #$00 ; black + STA $D021 ; background + LDA #$05 ; dark green + STA $D022 ; Extra background color #1 + LDA #$08 ; orange + STA $D023 ; Extra background color #2 + LDA $D016 ; Screen control register #2 + ORA #$10 ; Bit #4: 1 = Multicolor mode on. + STA $D016 + + LDA #$30 ; 0011 0000 $3000 charset page + STA PLOTH + LSR + LSR + STA PLOTC ; 0000 1100 #$0C +; 53272 $D018 +; POKE 53272,(PEEK(53272)AND240)+12: REM SET CHAR POINTER TO MEM. 12288 +; Bits #1-#3: In text mode, pointer to character memory +; (bits #11-#13), relative to VIC bank, memory address $DD00 +; %110, 6: $3000-$37FF, 12288-14335. + LDA $D018 + AND #$F0 + ORA PLOTC + STA $D018 +; setup nine characters + +; 00- 00 00 + LDA #$00 ; chr(0) * 8 + STA PLOTL + ; --- LDA #$00 ; already zero + TAX ; LDX #$00 + JSR charset + +; 04- 00 55 + LDA #32 ; chr(4) * 8 + STA PLOTL + LDA #$55 + ; LDX #$00 ; already zero + JSR charset + +; 09- 00 AA + LDA #72 ; chr(9) * 8 + STA PLOTL + LDA #$AA + ; LDX #$00 ; already zero + JSR charset + +; 40- 55 00 + LDA PLOTH ; 512 = chr(64) * 8 + CLC + ADC #$02 + STA PLOTH + LDX #$00 + STX PLOTL + LDA #$00 + LDX #$55 + JSR charset + +; 44- 55 55 + LDA #32 ; chr(68) * 8 + STA PLOTL + TXA ; LDA #$55 + ; LDX #$55 ; already 55 + JSR charset + +; 49- 55 AA + LDA #72 ; chr(73) * 8 + STA PLOTL + LDA #$AA + ; LDX #$55 ; already 55 + JSR charset + +; 90- AA 00 + LDA PLOTH ; chr(144) * 8 + CLC + ADC #$02 + STA PLOTH + LDA #128 + STA PLOTL + LDA #$00 + LDX #$AA + JSR charset + +; 94- AA 55 + LDA #160 ; chr(148) * 8 + STA PLOTL + LDA #$55 + ; LDX #$AA ; already AA + JSR charset + +; 99- AA AA + LDA #200 ; chr(153) * 8 + STA PLOTL + TXA ; LDA #$AA + ; LDX #$AA ; already AA + JSR charset + JMP default +charset: + LDY #$00 +chartop: + STA (PLOTL),Y + INY + CPY #$04 + BNE chartop + TXA +charbtm: + STA (PLOTL),Y + INY + CPY #$08 + BNE charbtm + RTS + +; end COMMODORE 64 specific diff --git a/Task/Forest-fire/ALGOL-68/forest-fire.alg b/Task/Forest-fire/ALGOL-68/forest-fire.alg new file mode 100644 index 0000000000..de09f654d1 --- /dev/null +++ b/Task/Forest-fire/ALGOL-68/forest-fire.alg @@ -0,0 +1,59 @@ +LONG REAL tree prob = 0.55, # original tree probability # + f prob = 0.01, # new combustion probability # + p prob = 0.01; # tree creation probability # +MODE CELL = CHAR; CELL empty=" ", tree="T", burning="#"; +MODE WORLD = [6, 65]CELL; + +PROC has burning neighbours = (WORLD world, INT r, c)BOOL:( + FOR row shift FROM -1 TO 1 DO + FOR col shift FROM -1 TO 1 DO + INT rs = r + row shift, cs = c + col shift; + IF rs >= LWB world AND rs <= UPB world AND + cs >= 2 LWB world AND cs <= 2 UPB world THEN + IF world[rs, cs] = burning THEN true exit FI + FI + OD + OD; + FALSE EXIT + true exit: TRUE +); + +PROC next state = (REF WORLD world, REF WORLD next world)VOID:( + FOR r FROM LWB world TO UPB world DO + REF[]CELL row = world[r, ]; + FOR c FROM LWB row TO UPB row DO + REF CELL elem = row[c]; + next world[r, c] := + IF elem = empty THEN + IF random

: -> real diff --git a/Task/JSON/ANTLR/json.antlr b/Task/JSON/ANTLR/json.antlr new file mode 100644 index 0000000000..e518f6b9be --- /dev/null +++ b/Task/JSON/ANTLR/json.antlr @@ -0,0 +1,23 @@ +// Parse JSON +// +// Nigel Galloway - April 27th., 2012 +// +grammar JSON ; +@members { +String Indent = ""; +} +Number : (('0')|('-'? ('1'..'9') ('0'..'9')*)) ('.' ('0'..'9')+)? (('e'|'E') ('+'|'-')? ('0'..'9')+)?; +WS : (' ' | '\t' | '\r' |'\n') {skip();}; +Tz : ' ' .. '!' | '#' .. '[' | ']' .. '~'; +Control : '\\' ('"'|'\\'|'/'|'b'|'f'|'n'|'r'|'t'|UCode); +UCode : 'u' ('0'..'9'|'a'..'f'|'A'..'F') ('0'..'9'|'a'..'f'|'A'..'F') ('0'..'9'|'a'..'f'|'A'..'F') ('0'..'9'|'a'..'f'|'A'..'F'); +Keyword : 'true' | 'false' | 'null'; +String : '"' (Control? Tz)* '"'; +object : '{' {System.out.println(Indent + "{Object}"); Indent += " ";} (pair (',' pair*)*)? '}' {Indent = Indent.substring(4);}; +pair : e = String {System.out.println(Indent + "{Property}\t" + $e.text);} ':' value; +value : Number {System.out.println(Indent + "{Number} \t" + $Number.text);} + | object + | String {System.out.println(Indent + "{String} \t" + $String.text);} + | Keyword {System.out.println(Indent + "{Keyword} \t" + $Keyword.text);} + | array; +array : '[' {System.out.println(Indent + "Array"); Indent += " ";} (value (',' value)*)? ']' {Indent = Indent.substring(4);}; diff --git a/Task/Knuth-shuffle/ALGOL-68/knuth-shuffle-1.alg b/Task/Knuth-shuffle/ALGOL-68/knuth-shuffle-1.alg new file mode 100644 index 0000000000..f5202e6668 --- /dev/null +++ b/Task/Knuth-shuffle/ALGOL-68/knuth-shuffle-1.alg @@ -0,0 +1,14 @@ +PROC between = (INT a, b)INT : +( + ENTIER (random * ABS (b-a+1) + (a maxlen) + { + list := thisword + maxlen := ThisLen + } +} + +IsSorted(word){ ; This function uses the ASCII value of the letter to determine its place in the alphabet. + ; Thankfully, the dictionary is in all lowercase + lastchar=0 + Loop, parse, word + { + if ( Asc(A_LoopField) < lastchar ) + return false + lastchar := Asc(A_loopField) + } + return true +} + +GUI, Add, Edit, w300 ReadOnly, %list% +GUI, Show +return ; End Auto-Execute Section + +GUIClose: +ExitApp diff --git a/Task/Pi/ALGOL-68/pi.alg b/Task/Pi/ALGOL-68/pi.alg new file mode 100644 index 0000000000..c1ae844874 --- /dev/null +++ b/Task/Pi/ALGOL-68/pi.alg @@ -0,0 +1,51 @@ +#!/usr/local/bin/a68g --script # + +INT base := 10; + +MODE YIELDINT = PROC(INT)VOID; +PROC gen pi digits = (INT decimal places, YIELDINT yield)VOID: +BEGIN + INT nine = base - 1; + INT nines := 0, predigit := 0; # First predigit is a 0 # + [decimal places*10 OVER 3]#LONG# INT digits; # We need 3 times the digits to calculate # + FOR place FROM LWB digits TO UPB digits DO digits[place] := 2 OD; # Start with 2s # + FOR place TO decimal places + 1 DO + INT digit := 0; + FOR i FROM UPB digits BY -1 TO LWB digits DO # Work backwards # + INT x := #SHORTEN#(base*digits[i] + #LENG# digit*i); + digits[i] := x MOD (2*i-1); + digit := x OVER (2*i-1) + OD; + digits[LWB digits] := digit MOD base; digit OVERAB base; + nines := + IF digit = nine THEN + nines + 1 + ELSE + IF digit = base THEN + yield(predigit+1); predigit := 0 ; + FOR repeats TO nines DO yield(0) OD # zeros # + ELSE + IF place NE 1 THEN yield(predigit) FI; predigit := digit; + FOR repeats TO nines DO yield(nine) OD + FI; + 0 + FI + OD; + yield(predigit) +END; + +main:( + INT feynman point = 762; # feynman point + 4 is a good test case # +# the 33rd decimal place is a shorter tricky test case # + INT test decimal places = UPB "3.1415926.......................502"-2; + + INT width = ENTIER log(base*(1+small real*10)); + +# iterate throught the digits as they are being found # +# FOR INT digit IN # gen pi digits(test decimal places#) DO ( #, + ## (INT digit)VOID: ( + printf(($n(width)d$,digit)) + ) +# OD #); + print(new line) +) diff --git a/Task/Quine/ALGOL-68/quine-1.alg b/Task/Quine/ALGOL-68/quine-1.alg new file mode 100644 index 0000000000..003098ad90 --- /dev/null +++ b/Task/Quine/ALGOL-68/quine-1.alg @@ -0,0 +1 @@ +STRINGa="STRINGa=,q=REPR34;print(a[:8]+q+a+q+a[9:])",q=REPR34;print(a[:8]+q+a+q+a[9:]) diff --git a/Task/Quine/ALGOL-68/quine-2.alg b/Task/Quine/ALGOL-68/quine-2.alg new file mode 100644 index 0000000000..6cd1abe369 --- /dev/null +++ b/Task/Quine/ALGOL-68/quine-2.alg @@ -0,0 +1 @@ +[]CHARa="[]CHARa="";print(2*a[:9]+2*a[9:])";print(2*a[:9]+2*a[9:]) diff --git a/Task/Quine/AutoHotkey/quine-1.ahk b/Task/Quine/AutoHotkey/quine-1.ahk new file mode 100644 index 0000000000..e985ef2fbc --- /dev/null +++ b/Task/Quine/AutoHotkey/quine-1.ahk @@ -0,0 +1,2 @@ +FileRead, quine, %A_ScriptFullPath% +MsgBox % quine diff --git a/Task/Quine/AutoHotkey/quine-2.ahk b/Task/Quine/AutoHotkey/quine-2.ahk new file mode 100644 index 0000000000..6543472d63 --- /dev/null +++ b/Task/Quine/AutoHotkey/quine-2.ahk @@ -0,0 +1,32 @@ +D(n, s) +{ + global + Loop %n% + { + l := %s%%A_Index% + If l = # + l := "script =" . nl . "( %" . nl . script . nl . ")" + FileAppend %l%%nl%, %A_ScriptDir%\Q.txt + } +} +nl := Chr(13) . Chr(10) +script = +( % +D(n, s) +{ + global + Loop %n% + { + l := %s%%A_Index% + If l = # + l := "script =" . nl . "( %" . nl . script . nl . ")" + FileAppend %l%%nl%, %A_ScriptDir%\Q.txt + } +} +nl := Chr(13) . Chr(10) +# +StringSplit q, script, %nl% +D(q0, "q") +) +StringSplit q, script, %nl% +D(q0, "q") diff --git a/Task/Quine/AutoHotkey/quine-3.ahk b/Task/Quine/AutoHotkey/quine-3.ahk new file mode 100644 index 0000000000..c99ad39da6 --- /dev/null +++ b/Task/Quine/AutoHotkey/quine-3.ahk @@ -0,0 +1,8 @@ +quote := Chr(34) +sep := Chr(36) +nl := Chr(13) . Chr(10) +script := "quote := Chr(34)$sep := Chr(36)$nl := Chr(13) . Chr(10)$script := #$s := script$StringReplace script, script, %sep%, %nl%, All$StringReplace script, script, #, %quote%%s%%quote%$FileAppend %script%, %A_ScriptDir%\Q.txt" +s := script +StringReplace script, script, %sep%, %nl%, All +StringReplace script, script, #, %quote%%s%%quote% +FileAppend %script%, %A_ScriptDir%\Q.txt diff --git a/Task/Quine/AutoHotkey/quine-4.ahk b/Task/Quine/AutoHotkey/quine-4.ahk new file mode 100644 index 0000000000..73728f5479 --- /dev/null +++ b/Task/Quine/AutoHotkey/quine-4.ahk @@ -0,0 +1 @@ +FileCopy, %A_ScriptFullPath%, %A_ScriptDir%\Copy-Of--%A_ScriptName% diff --git a/Task/Search-a-list/ALGOL-68/search-a-list-1.alg b/Task/Search-a-list/ALGOL-68/search-a-list-1.alg new file mode 100644 index 0000000000..a61d4195e6 --- /dev/null +++ b/Task/Search-a-list/ALGOL-68/search-a-list-1.alg @@ -0,0 +1,24 @@ + FORMAT hay stack := $c("Zig","Zag","Wally","Ronald","Bush","Krusty","Charlie","Bush","Bozo")$; + + FILE needle exception; STRING ref needle; + associate(needle exception, ref needle); + + PROC index = (FORMAT haystack, REF STRING needle)INT:( + INT out; + ref needle := needle; + getf(needle exception,(haystack, out)); + out + ); + + test:( + []STRING needles = ("Washington","Bush"); + FOR i TO UPB needles DO + STRING needle := needles[i]; + on value error(needle exception, (REF FILE f)BOOL: value error); + printf(($d" "gl$,index(hay stack, needle), needle)); + end on value error; + value error: + printf(($g" "gl$,needle, "is not in haystack")); + end on value error: reset(needle exception) + OD + ) diff --git a/Task/Search-a-list/ALGOL-68/search-a-list-2.alg b/Task/Search-a-list/ALGOL-68/search-a-list-2.alg new file mode 100644 index 0000000000..da1f3432d2 --- /dev/null +++ b/Task/Search-a-list/ALGOL-68/search-a-list-2.alg @@ -0,0 +1,28 @@ + []STRING hay stack = ("Zig","Zag","Wally","Ronald","Bush","Krusty","Charlie","Bush","Bozo"); + + PROC index = ([]STRING hay stack, STRING needle)INT:( + INT index; + FOR i FROM LWB hay stack TO UPB hay stack DO + index := i; + IF hay stack[index] = needle THEN + found + FI + OD; + else: + LWB hay stack - 1 + EXIT + found: + index + ); + test:( + []STRING needles = ("Washington","Bush"); + FOR i TO UPB needles DO + STRING needle := needles[i]; + INT result = index(hay stack, needle); + IF result >= LWB hay stack THEN + printf(($d" "gl$, result, needle)) + ELSE + printf(($g" "gl$,needle, "is not in haystack")) + FI + OD + ) diff --git a/Task/Search-a-list/AutoHotkey/search-a-list.ahk b/Task/Search-a-list/AutoHotkey/search-a-list.ahk new file mode 100644 index 0000000000..56486ac814 --- /dev/null +++ b/Task/Search-a-list/AutoHotkey/search-a-list.ahk @@ -0,0 +1,9 @@ +haystack = Zig Zag Wally Ronald Bush Krusty Charlie Bush Bozo +needle = bush, washington +Loop, Parse, needle, `, +{ + If InStr(haystack, A_LoopField) + MsgBox, % A_LoopField + Else + MsgBox % A_LoopField . " not in haystack" +}