OOTPL

From Esolang
Jump to navigation Jump to search

Introduction

OOTPL (Only One Token Per Line), created by Noedig101 (talk) 18:24, 4 March 2024 (UTC), has the exact same syntax as Python. However, you can only have one token or value per line. If more than one token or value appears on the same line, a syntax error will be given. Line continuation is necessary for certain commands. Any braces or mathematical operators must be at the end of a line and must have at least three spaces between them and the token or value on that line. It is recommended that these are placed in the same position vertically for readability.

Instructions

Most commands in Python can be achieved without line continuation, such as the print command.

print            (
"Hello World!"   )

Some commands, like variable assignment and if/else statements, must be done using line continuation with \.

var                 =\
"value"

if                  \
var                 ==\
"value"             \
or                  \
True                :
    print           (
    "Hello World"   )
else                :
    print           (
    "Example"       )

Lists can be done like so:

lst    =[
1      ,
"Hi"   ,
None   ,[
"no"   ,
-3     ,]
True   ]

Commands with multiple arguments also work the same way.

functionName   (
arg1           ,
arg2           ,
arg3           )

Importing modules would work like this:

import       \
moduleName

from      \
random    \
import    \
randint

Examples

Hello World!

print           (
"Hello World"   )

Prints input.

print   (
input   ())

99 bottles of beer.

a                                                    =\
99
while                                                \
a                                                    >=\
0                                                    :
    if                                               \
    a                                                >\
    0                                                :
        print                                        (
        str                                          (
        a                                            )+\
        " bottles of beer on the wall,"              )
        print                                        (
        str                                          (
        a                                            )+\
        " bottles of beer!"                          )
        print                                        (
        "Take one down, pass it around,"             )
        if                                           \
        a                                            ==\
        1                                            :
            print                                    (
            "No more bottles of beer on the wall."   )
        else                                         :
            print                                    (
            str                                      (
            a                                        -\
            1                                        )+\
            " bottles of beer on the wall."          )
        a                                            -=\
        1
    else                                             :
        print                                        (
        "No more bottles of beer on the wall,"       )
        print                                        (
        "No more bottles of beer!"                   )
        print                                        (
        "Go to the store and buy some more,"         )
        print                                        (
        "99 bottles of beer on the wall!"            )

Note: this is my first esolang article, and will probably have some mistakes. If you have any questions email me at noedig101@gmail.com