P+ is for...
- Performance
- Power
- Productivity
... and most importantly:
- It makes sense.
Keywords surrounded by
- brackets (
[]) are optional - angle brackets (
<>) must be replaced by a name of your choice - backticks (
`) are required and escapes these definitions (i.e.`<type>`means you must literally type<type>) - parentheses (
()) and seperated by bars (|) are part of a list of mutually exclusive required keywords - brackets (
[]) and seperated by bars (|) are part of a list of mutually exclusive optional keywords
Everything else is required.
charnumberbool(array|list|pointer)[*<n>]func
only [register|stack|heap] [volatile] [unique] [func] (array|list|pointer)[*<n>] [chan][register|stack|heap] [const|volatile] [unsigned|signed|fraction] number [func] [(array|list|pointer)[*<n>]] [chan]only [register|stack|heap] [volatile] [unsigned|signed|fraction] number [func] (array|list|pointer)[*<n>] [chan][register|stack|heap] [const|volatile] [unsigned|signed] (int|char) [func] [(array|list|pointer)[*<n>]] [chan]only [register|stack|heap] [volatile] [unsigned|signed] (int|char) [func] (array|list|pointer)[*<n>] [chan]
voidtype <custom type> extends <type1>[`|`<type2>`|`<type3>...]clang <type> <function name>([<parameters>]) { <C code> }- Not specifying a type for a function parameter allows the parameter to be of any type.
var`<type>`var`<size>`var`<memsize>`var`<alignment>`var`<scope>`(default:1)some_fraction`<precision>`[NOTE: The precision value is the number of bits for the exponent, not the number of decimals]pointer_to_list`<length>`[NOTE:some_list`<`<property>`>`will not access the property of the whole list, but the properties of each item of the list.* Use->some_list`<`<property>`>`instead. ]pointer_to_list`<separator>`str`<encoding>`(default:'utf-8')channel`<buffer>`(default:1)var>bit<- You can assign properties at variable creation:
<type> [`<`<property1>`>`=<property1 value> `<`<property2>`>`=<property2 value>...] var
*This is because some_list`<`<property>`>` decays into pointer_to_list[>>>]`<`<property>`>`
+-*/%**
&|~^<<>>
+=-=*=/=%=&=|=^=<<=>>=
!&&||
==!=><>=<=
? :(NOTE: Might get replaced byifin the future, and the?might be used for exception handling instead)->[]@>>><<<in(example:if(item in arr) ...)
str[>>>] == "Test"str[start >>> stop]str == addressstr[when <condition> >>> until <condition>]pointer sublist -> some_list[start >>> stop]pointer sublist2 -> some_list[when <condition> >>> until <condition>]pointer new_sublist -> [1, 2, 3]pointer new_subarr -> {1, 2, 3}str[<<<] == "tseT"str[stop <<< start]
if(<condition>) { <code> } [else if(<condition>) { <code> } else if...] [else { <code> }]match(<var>) { case <val1>: <code> [case <val2>: <code>...] [default: <code>] }(equivalent of C'sswitch)
"null terminated string"'string size determined by <size> property''null terminated string, but <size> property can still be used to get size\0'"null terminated string" == 'null terminated string\0'
func <function>([<parameters>]) [-> <return type>] { <code> }<function>([parameters])or<function> <parameter>or<parameter> <function> <parameter>return [from <function>] <value>- Functions return the result of the last statement by default; no need to use
returnunless you want to return from somewhere else. - P+ allows ad-hoc polymorphism; you can create multiple functions with the same name but with different parameters.
- Operator overloading is supported; for example, doing
func +(...)would overload the+operator.
while(<condition>) { <code> }foreach <item> in <list> { <code> }repeat(<n times>) { <code> }breakcontinue
async { <code> }select { <cases> }send <data> to <channel><type> <var> = receive from <channel>
#def '<code>' as '<code>'(will support regex in the future using#{<regex>}, as well as%{(property|properties|var)})#if <condition>#else#elif <condition>#ifdef <const>#ifndef <const>#endif
goto <label>#import (('|")<path>('|")|`<`<std lib path>`>`) [as <name>]#export <function1>[, <function2>...]eval '<code>'
__OS__path__args__argc__line__item__app
// <One line comment>
/* <Multi
line
comment> */
(),[],.,++,--!,~,(<type>),@,->*,/,%,**+,->>,<<<,<=,>,>===,!=&^|&&||?:=,+=,-=,*=,/=,%=,>>=,<<=,&=,^=,|=>>>,<<<,,,in