Plasma Syntax to Concept Map

Copyright (C) Plasma Team
Distributed under CC BY-SA 4.0

Updated: April 2017
Source: on github
Table of Contents

The purpose of this document is to show for each syntax-ish thing, what the underlying concept is. This should help us design the language on a coherent way. It is not intended as user documentation.

Brackets

Table 1. Brackets

Brackets

Concept(s)

Comment

( )

Expression grouping, parameter lists (functions, types & structs)

Familiar to many programmers

{ }

Code

[ ]

Lists (arbitrary size)

Lists, for loop parameters (unimplemented), array indexing.

[- -] or [ ]

Streams

Future, maybe use the ~ or - to denote whether it’s a lazy list or a parallel stream (channel).

[: :]

Arrays (fixed size sequences)

[% %] or [# #] or something else?

Dictionariies,

Symbols

Table 2. Symbols

Symbol

Concept(s)

Comment

//

Comment

/* */

Comment

_ (underscore)

Wildcard

Used instead of variables in patterns, arguments and the LHS of assignments

\*, /, %, +, \-

Arithmetic operators

-

Unary minus

Similar concept as subtraction

<, >, , >=, ==, !=

Comparison operators

and, or, not

Logical operators

Not really "symbols" in the character ranges meaning of the word, but included here alongside other operators.

++

Concatenation operator

,

Parameter separation

in function results, argument lists (functions and types) and field lists, loop dot products.

*

Wildcard (in import/export lists), Multiplication

|

"or" in structure and type alternatives, "join" in lists and other structures.

&

"and" cross product in loop inputs.

Future, maybe, "and" doesn’t mean "cross" or "by".

:

"has type"

.

Scope qualification (access something from within another scope)

->

"results in"

Used to separates a function’s return values from its inputs, may be used in lambda expressions also.

<-

"gets", different from "let"

Part of loop syntax, unimplemented.

=

"let"

The LHS (a new variable) is given the value of the RHS (also in struct construction and deconstruction). Or in type declarations, the type name on the LHS has the set of values from the RHS. Or in list outputs and reductions (unimplemented). In all of these cases the meaning is "let".

:=

"store" or "write"

The value on the LHS is updated with the RHS, this makes sense for arrays.

!

Side-effect

added to a function call to indicate that it uses or observers a resource.

..

"to"

Future: For ranges, eg in array slicing.

\

"lambda"

Future

$

Future: state variable syntax

@

"at"

Reserved in case I ever want to add pointer manipulation a la PAWNS.

#

Unused

%

Unused: Maybe string formatting?

Issues

Table 3. Issues

Symbol

Issue

[ ]

This usually means a sequence but is also used for array indexing. That appears to be in conflict, however using [ ] for lists and array indexing will be familiar from other languages.

|

Used in type and structure expressions to mean "or" and struct, list etc manipulation to mean "join".

{}, _() and {: :}

Minor issue, I kinda like {} for code and dictionaries and structures. But (so far) I’ve chosen to avoid these conflicts.