Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
173 lines (130 sloc) 3.27 KB
Plasma Syntax to Concept Map
============================
Paul Bone <paul@plasmalang.org>
v0.1, April 2017: Draft.
Copyright (C) 2017 Plasma Team
License: CC BY-SA 4.0
:toc:
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.
link:https://github.com/PlasmaLang/plasma/tree/master/docs/concept_map.txt[Contribute to this page]
== Brackets
.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*.
| +[- -]+
| Streams
| Future
| +[: :]+
| Arrays (fixed size sequences)
|
| +{: :}+
| Dictionariies,
|
|===
== Symbols
.Symbols
|===
|Symbol | Concept(s) | Comment
| +#+
| Comment
|
| +_+
| 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".
| +<=+
| "assign" 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.
|===
== Issues
.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.
|===