-
Notifications
You must be signed in to change notification settings - Fork 3
Syntax
This page is part of the Plain English programming language's wiki.
There are two themes:
-
Every statement the programmer enters should be actual English, i.e., something that someone might actually say or type or read.
-
Wherever possible, extensions should either be coded entirely in English, and/or interface with outside system(s) using English.
This project's language syntax is fully compatible with the language syntax of the Osmosian Order's official releases at www.osmosian.com . As described in the Compatibility Notes, this project also includes syntax features that are part of the Osmosian Order's latest development version that have not yet been included in the Osmosian Order's official releases.
(1) There are five kinds of sentences:
(a) type definitions, which always start with A, AN, or SOME;
(b) global variable definitions, which always start with THE;
(c) routine headers, which always start with TO;
(d) conditional statements, which always start with IF; and
(e) imperative statements, which start with anything else.
(2) A name is anything after A, AN, ANOTHER, SOME, or THE, up to:
(a) any simple verb, like IS, ARE, CAN, or DO, or
(b) any conjunction, like AND or OR, or
(c) any preposition, like OVER, UNDER, AROUND, or THRU, or
(d) any literal, like 123 or "Hello, World!", or
(e) any punctuation mark.
(3) Almost all other words are just words, except for:
(a) infix operators: PLUS, MINUS, TIMES, DIVIDED BY and THEN;
(b) special definition words: CALLED and EQUAL; and
(c) reserved imperatives: LOOP, BREAK, EXIT, REPEAT, and SAY.
Thus, the parsing is very simple. The compiler looks for marker words — articles, verbs, conjunctions, prepositions — then works its way around them.
- Plain English is not case sensitive. All string comparisons are case-insensitive. This project may choose to add some case sensitivity in the future.
- The compiler does not care where, or in what order, the definitions are placed. Plain English currently uses all text files that lack file extensions in the relevant directory (or directories) as the source code for a project -- except that "writer" files and spelling lexicons are ignored. The Osmosian Order's compiler uses text files in a single directory. This project uses either text files in a single directory (that does not contain a
noodle
subfolder), or text files in a directory and its immediate subfolders (if one of those subfolders is namednoodle
). - There are no nested IFs. Complicated decisions can be made using guard clauses in a decider function.
- There are no nested LOOPs. However, a loop can call other functions, which in turn can have up to one loop per function.
- Plain English does not have OBJECTs. Plain English does support a limited form of record extension, and can reduce types to other types. Plain English does not support namespaces or polymorphism. Plain English does support pointers, and it is possible to implement vtables in Plain English.
- Plain English does not have floats, doubles, or other REAL NUMBERs. Plain English does include ratios. If numbers larger than +/- 2^31 turn out to be needed, this project might add support for big numbers, and ratios thereof.
- Plain English does not use equals signs (=), parentheses, array dereferencing, or other mathematical symbols in EQUATIONS. Plain English does use infix math and "calculated fields".
For comparison, the Osmosian Order's version of Plain English is documented at www.osmosian.com/instructions.pdf