Skip to content
Jack Lloyd-Walters edited this page Jul 7, 2021 · 10 revisions

The following page lists example syntax, as well as a link to each issue that tracks the changes:

Example scripts are being generated using the syntax below. They can be found: here

End of line character

Python requires each line of code to be on it's own line, while languages like C and Java also use ; to deliniate the end of a command.

(so int x; x=10.5; printf(x); is three seperate commands, but they can be written on a single line)

As verboscript is close to written english, then a full stop could deliniate the end of a line of code, and each line of code could be called a "sentence".

Additionally, there should be an empty space between a full stop and the next sentence. The C example above could be written in verboscript as:

create a variable called x. set x to 10.5. show x.

This is equivalent to three different commands, but can go on a single line as the full stop seperates them. The spacing also allows the language to easily seperate a full stop from a decimal point.

Comments

Issue on this topic can be found here

single line comments:

C:

// this is a comment

Python:

# this is a comment

Block (multi line) comments

C:

/* this entire thing is a comment
Every single line, in fact */

Python:

‘’’ this entire thing is a comment
Every single line in fact ‘’’

Verboscript:

Line comment Comment: this line is a comment

Block Comment: TBD

Data Types

Numbers

Issue on this topic can be found here

numbers can be represented by their symbols, or their literal spelling:

6, six, 7.9, seven point nine

Do we allow mixing of symbol and literal?

13 point 9

Does this language utilise fractional parts?

ie: can 8.12 be represented as eight and twelve hundreths, or only 8 point one two?

(Standard english disregards eight point twelve as bad form`)

What about raw fractions?

seven halves, 9 over 6, eight on thirteen

Do we have native support for binary and other base systems?

ie: six in binary (0b110)

The hexidecimal A6E2 (42542)

Strings

Issue on this topic can be found here

How do we represent strings?

Do we use quotation marks:

"Hello there"

or do we allow anything to be a string with no marking

ie: Hello there

How do strings and numbers interact?

is "six" a string, or a number, or both?

what about "6"?

Operations

Issue on this topic can be found here

The Language should probably allow both symbol and literals, so that statements can be written either in english or maths

following above, this should definitely allow:

Addition

5 + 6, and 5 plus 6, and 5 add 6

What about slightly more verbose?

the addition of 5 with 6, or the sum of 5, 6, and 8

Subtraction

5 - 6, 5 minus 6

Multiplication

5 * 6, five times six

What about five multiplied by six?

Division

5 / 6, 5 divided by six

If we natively allow fractions in numbers, is six over five identical to declaring 1.2?

Variables

Issue on this topic can be found here

Languages without the ability to manipulate variables would be a touch lacking, so this is definitely a needed feature:

Declaration

Python example:

x = 5

C example:

int x; x=5;

Verboscript idea:

store 5 in the variable called x

make x have a value of 5

create a variable called x, with a value of 5

Assignment

Aditionally, languages support reassigning variables:

python:

x = "hello there"

example idea in verboscript:

set x to hello there

Augmented assignment:

Some languages also support assignment and modifying in place:

python example:

x = x + 5
x = 6 * x

#can be written as 

x += 5
x *= 6

which in verboscript could be:

add five to x
multiply x by six

Standard functions

print-to-screen command

Issue on this topic can be found here

The absolute basics for showing the state of the program:

Some languages use print(), others use printf()

the keyword "show" should come bfore anything that is to be printed to the screen.

ie, instead of print("hello world"), we use show hello world

Multiple keywords can be used, not just show, of course

when using show, any variable names are automatically converted to their values:

if the variable "x" was 10, then show x would show "10" on the screen

However, using the variable name in quotat

Input-from-user

Issue on this topic can be found here

This is an undecided topic, the issue above has not been resolved

Control Flow

Logical comparisons

These determine if a statement is true or false, for example, in python:

print( x == 0)

will show True, if x is equal to zero, or False if it is not.

a verboscript example may be:

show x is equal to zero.

Equality

Python: a == b, Verboscript: a is equal to b

Inequality

Python: a != b, Verboscript: a is not equal to b

Size

Python: a > b, Verboscript: a is greater than b

Python: a >= b, Verboscript: a is greater than or equal to b, or a is greater or equal to b

Python: a < b, Verboscript: a is less than b

Python: a <= b, Verboscript: a is less than or equal to b, or a is less or equal to b

Logical and

Usefull for ensuring multiple things are true

python: a && b, verboscript: a and b.

ie: python (a > 2) && (b < 4), verboscript: a is greater than 2, and b is greater than 4.

additionally, the comma before the and above could seperate the left and right sides of the end, else they may be ambiguous. ie:

a is greater than 2 and b is greater than 4. could be misconstrued as: (a is greater than 2 and b) is greater than 4.

although brackets would prbably be more useful?

Logical or

Usefull for ensuring multiple things are true

python: a || b, verboscript: a or b.

Logical not

Usefull for ensuring multiple things are true

python: !a, verboscript: not a.

Branches

Issue on this topic can be found here

These are language constructs that allow you to select different branches to execute

If statement

A singular if is the simplest branching statement, and decides whether a chunk of code will be executed or not, depending on some condition.

Python:

if x == 0:
  print("x was zero")

Verboscript:

if x is equal to zero, then do the following:
  show "x" was zero.

Else statement

if the if was not true, then the else is triggered:

Python:

if x == 0:
  print("x was zero")
else:
  print("x was not zero")

Verboscript:

if x is equal to zero, then do the following:
  show "x" was zero.
otherwise, do this:
  show "x" was not zero.
if x is equal to zero, then do the following:
  show "x" was zero.
else, do this:
  show "x" was not zero.

both otherwise and else could be applicable.

Elif statements

These execute if the initial If was false, and can form an indefinitely long chain:

Python:

if x == 0:
  print("x was zero")
elif x == 2:
  print("x was two")
elif x == 7:
  print("x was seven")
elif x == 354:
  print("x was three hundred and fifty four")
else:
  print("x was not any of the numbers listed")

Verboscript could instead make use of a modified version of the else command decided above:

if x is equal to zero, then do the following:
  show "x" was zero.
else, if x is equal to two, then do this:
  show "x" was two.
if x is instead equal to seven, then do this:
  show "x" was seven.
alternatively, if x is equal to three hundred and fifty four, then do this:
  show "x" was three hundred and fifty four.
otherwise, do this:
  show "x" was not any of the numbers listed.

We can see three potential elif syntaxes, each of which have their own merits.

Loops

Issue on this topic can be found here

Rather than choosing a single block of code to execute, it can sometimes be helpful to repeat execution. The two most common methods are the while and for loops:

While

The while loop continues to execut its block, so long as the condition in the while <condition> is true. Many programmers create an infinite loop by setting this condition to true:

Python:

while true:
    print(“loops up”)

This language:

repeat the following forever:
    Show loops up.

or, if evaluating a condition:

Python:

while x == 2:
    print(“loops up”)

This language:

repeat the following while x is equal to two:
    Show loops up.

Until

The slightly less well known equivalent of while, until instead continues executing while the condition is false:

(modern languages like python and C do not have a direct anaglogue)

while x != 2:
  print(x)

verboscript:

repeat the following until x is equal to two:
  show x.

For

these will execute a defined number of times, or over an itterable sequence such as a list

Python:

for x in range(10):
    print(x)

# will show: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
for x in ["hi there", "hello", 4, 65, "yo"]:
    print(x)

# will show: "hi there", "hello", 4, 65, "yo"

verboscript:

Start a counter at zero, and repeat the following ten times:
    show the counter

or with an alternative order:

repeat the following ten times, with a counter starting at zero:
    show the counter

and potential list for loops:

create a list called test, whose contents are: "hi there", "hello", 4, 65, "yo"
repeat the following with each item from test:
  show this item.

The above is a little clunky, as lists have not been considered for this language yet.