logOS

From Esolang
Jump to navigation Jump to search

logOS is an imperative and partially object-oriented language based around the 'Desktop metaphor' that modern operating systems use. It was brainstormed with the unaffiliated Esolangs Discord server and implemented in Python by User:IFcoltransG in late 2019.

Programs

Programs are built-in objects, and their commands are methods or functions that transform text. Each program stores data in a buffer, a string that is manipulated whenever a program's commands are executed. Editor is a text editor used for manipulating the strings that are the lifeblood of any logOS algorithm. Calculator can parse arithmetic with order of operations. Email is used for IO. Terminal parses and executes logOS code, so can be used for control flow.

Example Code

Hello World

Editor
write "Hello, world!"
copy
minimise
Email
paste
send

With comments:

rem "rem" starts a comment.
rem Start a text editing program:
Editor
rem Input the appropriate words to the text editor:
write "Hello, world!"
rem Note that "write" only works while in the text editor.
copy
rem Bring up the Desktop:
minimise
rem Start up Email - the tool used for communicating with the user:
Email
paste
rem Output whatever the Email program stores in its buffer to the user.
send

A golfed version:

Email Hello, world!
send

cat

Editor
rem Write out the main loop code.
rem "write" without arguments writes a newline.
write "switch Email"
write
write "refresh"
write
write "send"
write
write "switch Terminal"
write
rem The "run" command deletes the contents of the Terminal.
write "paste"
write
write "run"
rem Move the code to the clipboard
cut
minimise
rem Boot up Email so the loop can switch to and from it.
Email
minimise
Terminal
paste
rem Run the program's contents as logOS code:
run

Truth-machine

Editor paste\nswitch Email\nsend\nswitch Terminal\nrun
replace "\n" with newline
cut
minimise
LOOP
paste
minimise
Email
refresh
copy
switch Editor
paste
replace "1" with "switch LOOP\ncopy\nswitch Terminal\npaste\nrun"
replace "\n" with a newline
replace "0" with "rem"
cut
minimise
Terminal
paste
run

Etymology

The name is a combination of the word logos meaning reason and logic, and OS for Operating System. The log also represents the fact that source code looks like a transcript of a person accessing a computer. The language doesn't have any logos designed yet.

External Resources

  • A specification can be found here.
  • The implementation can be found here.