Is it possible to build a language with full turing in which each line is the correct program?

Is it possible to build a language code in which each line is the correct program?

Any examples? Better yet, any real examples?

Accuracy: by “correct” I mean “compiles”, although “works without errors” and “runs without errors and ends in a finite time” would also be interesting questions :)

By string, I mean any sequence of bytes, although this character set restriction will be met.

+3
source share
9 answers

, . C, . C, , . "Hello, world!". .

, .

+5

(, , - ). brainfuck .

... oh [], "meh. nitpickers" .

, ;)

+9

C- , BNF

<program> ::= <character> | <character> <program>

#!/bin/bash
# full_language.sh

gcc "$1"
if [ $? != 0 ]
then
    echo -e "#!/bin/bash\necho 'hi'" > a.out
    chmod +x a.out
fi
+7

: perl.

+4

, "" "", "" . , , "" .

+2

, . ( {K, S, @}) . , althogh , .

, . : , ( ). " " "@? ? , ! , Omega - , , , , , .

: {K, S, @}, , ( ) . , , , , "" (, Omega).

, TokenMacGuy, , , , Jot , TokenMacGuy .

+2

- " " .

: http://en.wikipedia.org/wiki/Turing_completeness

" , , , Turing-complete, (. ).

+1

What you are describing is essentially like matching from the Godel number to the original program. In short, the idea is that each program should be reducible to a unique integer, and you can use it to display results about the program, for example, using oracle . One of these mappings is the Jot language, which has only two operators: 1 and 0, and the first operator must be 1.

+1
source

Source: https://habr.com/ru/post/1717077/


All Articles