A.R.T.I.C.L.E. Lang

From Esolang
Jump to navigation Jump to search

A.R.T.I.C.L.E. is an esoteric programming language created in october 5 2020 by User:SoicBR


A.R.T.I.C.L.E. stands for: Apple Random Tower Island Cat LOL Elephant


In A.R.T.I.C.L.E., you code with OPcodes defined by the number of words in a phrase. The language was intended to look like an essay, you can TECHNICALLY write an program that looks like an essay. The initial name was E.S.S.A.Y., but later the name was changed to A.R.T.I.C.L.E. due to the fact that a language named essay already exists.


Words

A word is a string separated by '\t', '\n' and ' '. A string won't count as a word if it doesn't contain at least one of the following characters:

 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'ç', 'à', 					 
 'á', 'é', 'í', 'ó', 'ú', 'â', 'ê', 'î', 'ô', 'û'.


Phrases

The OPcode is defined by number of words in a phrase (a phrase is a set of words separated by '.'). Some instructions require using extra phrases as arguments. Nothing will happen if you try to use an invalid instruction.

The phrase pointer (the program counter) used in the official interpreter is a signed 32-bit integer. The language uses 0-based indexing.

Numbers

The instructions AA and AS require inserting bytes (0x00 to 0xff). Any time that an instruction asks for a number, the next two phrases will be the number. Each figure at a time, in hexadecimal, the digit is defined by:

 Number of words in the phrase - 5

Example: if you want to write 0x1a, you can write:

 [6 words]. [15 words].

Note: invalid numbers will make the program crash.

The Stack

A.R.T.I.C.L.E. has an ifinite stack, which the value of the accumulator(seen later) can be pushed into the stack or the stack can be popped and this value will be added to the accumulator


All instructions that use the stack:

[04 words] - Stack Reverse Order (SRO)

Invert the order of the values that are are currently in the stack. Nothing will happen if the stack has less than two values.


[05 words] - Stack Push From Accumulator (SPFA)

Pushes the current value of the accumulator to the stack.


[06 words] - Stack Pop to Accumulator (SPA)

Removes a value from the stack and adds it to the accumulator. If the stack is empty, the program will crash.


[07 words] - Stack Swap First Two Values (SSFTV)

Swaps the first two values of the stack. The program will crash if there's less than two values in the stack.


[08 words] - Pop From Stack and Compare to Accumulator (PFSCA)

Removes the first item of the stack(SI), and compares it to the accumulator(A). If A == SI, nothing happens, else, A = 0. If the stack is empty, the program will crash.


[09 words] - Pop From Stack Index the Value Index as Current Value of the Accumulator to the Accumulator (PFSIVWICVAA)

Uses the accumulator as index and pops from stack at specified index.


[10 words] - Push to Stack Index the Value of the Accumulator After Popping the Index and Using This Value as Index (PSIVAAPIUTVI)

This is the most complicated instruction in the whole language. Let's break it down: - Pops the first value of the stack to use it as index. - Stores at specified index the current value of the accumulator.

Note: the program will crash if the index is bigger than the current stack size + 1.

The accumulator

The accumulator is special variable which you can add or subtract numbers in it. It's where all calculations happen. Branching is based on the it's current value.

Note: the accumulator is a byte(an integer that ranges from 0 to 255).


All instructions that use the accumulator:

[11 words] [Number] - Accumulator Add (AA)

Adds the specified number to the Accumulator.


[12 words] [Number] - Accumulator Subtract (AS)

Subtract the specified number from the Accumulator.


[13 words] - Accumulator Input (AI)

Asks the used to input input a char and store it to the accumulator (the char will be stored as an ASCII number).


[14 words] - Accumulator Output (AO)

Outputs an ASCII char based on the current value of the accumulator.

Note: you need to manually add a newline (ASCII 0x0a).

Branching

With the branching instructions, you can jump the program execution to any point of the program.

All instructions about branching:

[15 words] [4 words + (word to jump)] - Branch to Next Ocurrence of Word (BNOW)

Jumps the program execution to the next phrase that the specified word appears (NOT case-sensitive). If the word isn't found, the program crashes.


[16 words] [4 words + (word to jump)] - Branch to Previous Ocurrence of Word (BPOW)

The same as BNOW, but it jumps to the previous word instead.


[17 words] [4 words + (word to jump)] - Branch to Next Ocurrence of Word if the Value of the Accumulator is Different From Zero (BNOWVADFZ)

The same as BNOW, but only works if A != 0.


[18 words] [4 words + (word to jump)] - Branch to Previous Ocurrence of Word if the Value of the Accumulator is Different From Zero (BPOWVADFZ)

The same as BPOW, but only works if A != 0.



Computational class

A.R.T.I.C.L.E., according to its creator, is probably turing complete. But no proof of its turing completeness exists.


Sample programs

The official interpreter comes with a few sample programs.

Hello World

Prints "Hello world" to the console.

 This is the first ever "useful" program written
 in the ARTICLE. It's an esoteric programming
 language made by me, Soic. I don't know what else to
 write but i still to write code.
 Now, it's time to print the first character in
 the very cool debug console.
 Here i go again to write code to a dumb
 language. I don't really know what to. say, yes
 i swapped the position of a period and a comma
 just because i'm very, very, lazy.
 Now, it's time to print the first character in
 the very cool debug console.
 Here i go yet again writing code to a dumb
 language. Yes, i am very LAZY. Lazy Lazy Lazy
 Lazy, laughing out loud, yes, i did this twice.
 Now, i will print the first character in
 the cool debug console yet again.
 Now, i will print the first character in
 the cool console yet again, again.
 Ngl, i'm out of ideas now and i'm just
 writing stuff. I need to write code.
 I need to write a lot of code.
 I'm tired, now i will just filler my way
 out f f f f.
 f0 f1 f2 f3 f4
 f5 f6 f7 f8 f9 f10 f11. n1 n2
 n3 n4 n5 n6 n7 n8 n9. n1 n2 n3 n4 n5 n6 n7 n8
 n9 n10 n11 n12 n13 n14 n15 n16 n17 n18 n19 n20.
 f means filler f f f f f f f f f f f.
 f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11. n1 n2 n3
 n4 n5 n6 n7 n8 n9 n10. n1 n2 n3 n4 n5 n6 n7 n8
 n9 n10 n11 n12.
 f f f f f f f f f f f f f f.
 f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12. n1 n2
 n3 n4 n5. n1 n2 n3 n4 n5 n6 n7 n8 n9 n10 n11 n12
 n13.
 f f f f f f f f f f f f f f.
 f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11. n1 n2
 n3 n4 n5. n1 n2 n3 n4 n5 n6 n7 n8.
 F f f f f f f f f f f f f f.
 f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12. n1 n2
 n3 n4 n5. n1 n2 n3 n4 n5 n6 n7 n8 n9 n10 n11.
 F f f f f f f f f f f f f f.
 f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12. n1 n2
 n3 n4 n5. n1 n2 n3 n4 n5 n6 n7 n8 n9 n10 n11 n12 n13.
 F f f f f f f f f f f f f f.


Uncommented cat program

A program that asks you for input, takes the input and prints it to the screen.

 Hi. Now you will be asked to input a char here in the console. That inputed char will be used to print a
 output message in the console.
 Now, the program execution will jump to the message at the start, a loop is
 created. Jump program execution to Hi.


Cat program

A program that asks you for input, takes the input and prints it to the screen.

 mainloop.
 input f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13.
 output f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14.
 jump_to_start f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15
 f16. f f f f mainloop.


Truth-machine

A regular Truth-machine.

 get_input f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13.
 push push push push push.
 push push push push push.
 zero_label.
 dec f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12. n n n n n.
 n n n n n n1.
 loop_until_0 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13
 f14 f15 f16 f17 f18. f f f f zero_label.
 add_0_to_compare f2 f3 f4 f5 f6 f7 f8 f9 f10 f11.
 n n n n n n1 n2 n3. n n n n n.
 pop_and_cmp f2 f3 f4 f5 f6 f7 f8.
 bnoc_0 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14
 f15 f16 f17. f f f f print_0.
 zero_label2.
 dec f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12. n n n n n.
 n n n n n n1.
 loop_until_0 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13
 f14 f15 f16 f17 f18. f f f f zero_label2.
 add_1_to_compare f2 f3 f4 f5 f6 f7 f8 f9 f10 f11.
 n n n n n n1 n2 n3. n n n n n n1.
 pop_and_cmp f2 f3 f4 f5 f6 f7 f8.
 bnoc_1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14
 f15 f16 f17. f f f f print_1.
 end_if_none f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14
 f15. f f f f end.
 print_1.
 print1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14.
 loop f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16.
 f f f f print_1.
 print_0.
 zero_label3.
 dec f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12. n n n n n.
 n n n n n n1.
 loop_until_0 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13
 f14 f15 f16 f17 f18. f f f f zero_label3.
 add_0_to_print f2 f3 f4 f5 f6 f7 f8 f9 f10 f11.
 n n n n n n1 n2 n3. n n n n n.
 print0 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14.
 get_input f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13. 
 end.


External resources