Incant
Paradigm(s) | imperative |
---|---|
Designed by | Proxxa |
Appeared in | 2024 |
Computational class | Unknown |
Reference implementation | Unimplemented |
File extension(s) | .grim , .grimoire , .incant |
- Incant is a work in progress. Both the language and the page are unfinished. The page exists to spark/record ideas for the language as time goes on. If you have ideas to share, please contact Proxxa on Discord (@yorip).
Incant is a procedural work-in-progress programming language designed to resemble entries in a magic grimoire. The design prioritizes style over computational power, and as such, its actual computational class is unknown. Please direct any suggestions on how to improve Incant to Proxxa on Discord (@yorip). As it may be clear from the description of the language and some examples, Incant is an entirely unserious language. While programs may be made in it, it is unlikely to have any real applications.
Language Overview
Incant "grimoires" (source files) consist of one or more "entries." Currently, the only kind of entry devised is the spell, which is nothing more than a function. Spells consist of little more than a header and body.
Keywords
Incant contains many keywords to keep its design dependent on language rather than many symbols.
Keyword | Description |
and | Mark the last entry in a list containing more than one element. |
cast | Call a function. |
named | Name some entry. |
say | Print something to the console. |
specialty | Mark the entry function. |
spell | Start a function definition. |
with | Supply parameters or arguments to a spell. |
Primitives
Incant contains multiple data primitives.
Type | Description |
integer | A signed integral number |
number | A signed floating point decimal number |
text | A string of text |
Identifiers
Identifiers in Incant are always capitalized. Furthermore, an identifier may contain spaces so long as each "word" in the identifier is capitalized. Numbers may appear in identifiers, but not at the start of a word. The following identifiers are valid:
Mead
,
Eye Of Newt
and L3TT3R B0X
.
However, the following are either invalid or considered multiple identifiers:
L13F 3R1K50N D4Y
,
Ball of Wax
,
and love
.
Functions
Functions, or spells, follow a style similar to C-family languages. The primary difference is that Incant avoids characters whenever it would not make sense in common language. To accomplish this, writing a spell may require multiple keywords. Each instruction in the spell is numbered as opposed to ending with a semicolon. The number must appear at the start of a line. The following example is a spell named Greeting
that will run at program start and print Hello
to the console.
specialty spell named Greeting 1. say "Hello"
A spell may be cast using the cast
keyword. The following example is functionally identical to the one above, but it demonstrates how to cast a spell.
specialty spell named Program 1. cast Greeting spell named Greeting 1. say "Hello"
Parameters
Parameters, or components, can be given to a spell using the with
keyword. Similarly, arguments may be provided with the keyword. A single parameter is simple enough: with "example"
is enough to provide the string "example"
to a spell. Multiple parameters should go along the rules for standard English lists. Two parameters are separated by the and
keyword, and three or more parameters should be separated by commas (,
) and the second-to-last and last parameters should be separated by the and
keyword. In the case of three or more parameters, the "Oxford's comma" may be added before the and
keyword, but it is not necessary. For example, with "First", "second", and "3rd"
is identical to with "First", "second" and "3rd"
.