foi-lang icon indicating copy to clipboard operation
foi-lang copied to clipboard

WIP: initial ast for program, comment, variable, reassignment

Open jschatz1 opened this issue 3 years ago • 2 comments

Initial AST for program, comments, variable declarations, and variable reassignment.

jschatz1 avatar Oct 03 '22 17:10 jschatz1

One thing I am not sure of is if "everything is a function" in foi or not. @getify what's your thoughts?

jschatz1 avatar Oct 06 '22 12:10 jschatz1

@jschatz1

No, not everything is a function.

For example, empty, import, def, deft, defn, over, as, and default are all keywords. We also values, like numbers and strings, as well as records and tuples, and those are all definitely not functions.

However, all operators are functions, and most non-identifier symbols are operators/functions. For example, the . looks like it might be a special syntax, but it's actually a binary accessor-operator, so x.1 can also be done as | . x 1 |. Same with the .. tuple-range operator and the ... spread operator.

Exceptions: the ; and : separators, the , comma (list separator), sigils like ^ (return) / & (pick) / % (map-field), the # pipeline topic / def-block context, the -> function-return-type marker, and several sets of paired delimiters like " double-quotes (string delimiters), | | evaluation-expression (lisp) form, < and > record/tuple delimiters, <{ }>, { }, [ ], ( ), ?/ /, etc.

getify avatar Oct 06 '22 13:10 getify