From 47c0a52e614d01eb251da9301c2961338141ab6c Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Wed, 29 Jun 2022 22:38:29 -0400 Subject: Editing continues, with some deletions this time --- docs/doc/context.html | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'docs/doc/context.html') diff --git a/docs/doc/context.html b/docs/doc/context.html index 23422fac..6a093c43 100644 --- a/docs/doc/context.html +++ b/docs/doc/context.html @@ -55,10 +55,7 @@ -

Unlike variables, BQN primitives have only one spelling, and a fixed role (but their values can be used in a different role by storing them in variables). Superscript glyphs ˙˜˘¨⌜⁼´˝` are used for 1-modifiers, and glyphs ∘○⊸⟜⌾⊘◶⎉⚇⍟⎊ with an unbroken circle are 2-modifiers. Other primitives are functions. String and numeric literals are subjects.

-

BQN's variables use another system, where the spelling indicates how the variable's value is used. A variable spelled with a lowercase first letter, like var, is a subject. Spelled with an uppercase first letter, like Var, it is a function. Underscores are placed where operands apply to indicate a 1-modifier _var or 2-modifier _var_. Other than the first letter or underscore, variables are case-insensitive.

-

The associations between spelling and syntactic role are considered part of BQN's token formation rules.

-

One rule for typing is also best considered to be a pre-parsing rule like the spelling system: the role of a headerless block {} is determined by which special arguments it uses: it's a subject if there aren't any, but a 𝕨 or 𝕩 makes it at least a function, an 𝔽 makes it a 1- or 2-modifier, and a 𝔾 always makes it a 2-modifier.

+

BQN uses a few rules to determine what role various parts of the grammar have. Primitive glyphs follow patterns: 1-modifiers like ˝ are superscripts and 2-modifiers like use circles. A variable can be spelled with different casing or underscores to indicate the role each time it's used.

The syntactic role is a property of an expression, and BQN's grammar determines how roles interact in expressions. But type is a property of a value, and evaluation rules control what types can be used. This means that roles exist statically in the code (context-free grammar!) while values can change between or within runs of the program. This is necessary to have a context-free grammar with unrestricted dynamic types. Are unrestricted dynamic types useful? Read on…

Mixing roles

BQN's value types align closely with its syntactic roles: functions, 1-modifiers, and 2-modifiers are all types (operation types) as well as roles, while the other types (data types) are split into numbers, characters, and arrays. This is no accident, and usually values will be used in roles that correspond to their underlying type. However, the ability to use a role that doesn't match the type is also useful.

-- cgit v1.2.3