Novel is going to be a new esolang based off of a choose your own adventure novel. It is going to be statically typed and incredibly verbose, with a focus on making code into a book-like format.
cargo run path/to/file
will output all of the syntax trees generated from the input. Most trees will be single entry trees, but math expressions are built into trees.
Currently I'm just working on adding in proper math evaluation, so nothing works yet. I'll continue to try and keep this updated as I add more syntax. Features may be added or removed, I'm in extremely early stages if that wasn't obvious.
I want many of the keywords and operators to have multiple aliases for the same underlying function. English has many synonyms and different ways of phrasing the same thing, and I want to embody that in this language. I've given a couple examples of various ways to phrase the same concept below but I will add many more as I go.
Most of the operators are going to be words instead of symbols, a pattern which will continue to the rest of the syntax.
-
to negate a numbernot
is equal to
|is
is not equal to
is less than
is greater than
and
or
it is
Assignment Operator(AO)
.
end of a private statement!
end of a public statement?
end of statement that may be null?!
|!?
|‽
end of a public statement that may be null
Novel will be a statically typed language, though I may have to implement that later in the developement.
There is a number called Example, it is 20.
declaring a private variable named Example, and initializing it with a value of 20
Declaration = DK Type IK ID, AO E EOS
- Declaration Keyword(DK) => There is a
- Type => string|number|boolean|class
- Identifier Keyword => called|named|labelled
- Identifier(ID) => A capital letter followed by any string of alphanumeric characters (including _).
- Assignment Operator(AO) => it is|she is|he is|they are
- Expression(E) => anything that evaluates to a value
- End Of Statement(EOS) => in Novel all text within a block is written on one continuous line, so an EOS symbol is necessary. Turning word wrap on is recommended
.
|!
|?
|!?
|?!
|‽
Subject to change, but I think there won't be any explicit features for looping and you'll have to do it with recursion instead.
if
; if
; otherwise
If Condition is true, do something; if OtherCondition is true, do something else; otherwise do this.
if condition, else if condition, else