Text (programming language)

From Uncyclopedia, the content-free encyclopedia
(Redirected from Txt)
Jump to navigation Jump to search
This page is about the programming language. For other uses, see Text (disambiguation).

Text is a programming language. Whilst not many people have heard of Text, almost all ASCII files, including readmes, and interpreted programming language source code files, are actually written in Text.

Description[edit | edit source]

All Text programs output their own source code.

Despite the language being very young, there's already tons of interpreters for Text, perhaps the most famous of which is Notepad. On Unix-derived systems, the traditional interpreter is 'cat'.

The file extension for Text programs is .txt.

Some relatively recent Text interpreters, such as TextEdit on the Macintosh, add support for 2D graphics.

Given that books and paper are fully capable of executing Text programs, they're actually probably some the first computers ever invented.

Examples[edit | edit source]

Hello World[edit | edit source]

Hello World

99 Bottles of Beer[edit | edit source]

Quines[edit | edit source]

A quine is a program that does not accept any input and outputs its own sourcecode. One of the short quines is:

42

A much longer quine is the source code of the Uncyclopedia article you are reading now.

Compilers[edit | edit source]

Here are a few compilers for Text:

echo - Present as a statement in some script language like Bash and Batch, executes a statement of a Text program

copy con - Present as a statement in Batch, executes a Text program written by the user in stdin and writes its output to a text file

type - Executes a Text program (from a source code file)


Even the recent Ideone.com online multiple language compiler can compile Text Programs. Its example program is: Charlie bit me! And it provides an example stdin: That really hurts! The application returns the value: Charlie bit me!

Development of a compiler[edit | edit source]

In fact it is really easy to make a Text compiler. Here are some examples. The first (made in Pascal) reads a Text statement and executes it. The second one (made in console VB.NET) reads from the command line a txt file and executes it (like type):

Pascal

 program textcompiler;
 uses crt;
 var a:string;
 begin
  a:='Here is a sample Text statement' // read the Text statement
  write(a); // execute the Text program
 end.

VB.NET

 Class TextCompiler

 Sub Main()
  Console.WriteLine(My.Computer.FileSystem.ReadAllText(Command())) 
  'executes the Text program inside a text file passed in the command line
 End Sub

 End Class

AWK

 1

BrainFuck

 >,[>,]<[<]>[.>]

C

This is a version that reads from text files, not from the console.

#include <stdio.h>
int main(int a, char *v[])
{
	FILE *f=fopen(v[1],"r");
	char c;
	while((c=fgetc(f))!=EOF)
		putchar(c);
}

Development environments[edit | edit source]

The most popular development environment for Text is named Notepad, and comes default with windows. It is simple, yet powerful, compiling and running the program as you type it.

Other development environments for Text include Leafpad (Linux), Wordpad (Windows), Emacs (Cross-platform), and Vim (Cross-platform).