aboutsummaryrefslogtreecommitdiff

compact representation

this document is in development/incomplete.

compact representation is a hopefully compact representation for ideas. this document serves as its official specification.

a CR "document" is a sequence of ASCII characters. characters outside of the range 0x20-0x7E are forbidden, except for \n (0x0A) and \t (0x09). when presenting CR to a human person, the exact encoding details are irrelevant, as humans read text with their eyes (or other sense organs). however, the characters in a CR document must be reasonably legible as their ASCII equivalents. it does not matter if the human reader is not able to discern the exact whitespace characters used in a document as long as they are able to discern their presence and location.

syntax

a CR document consists of any number of sentences. a sentence in CR consists of a single expression. each expression in CR evaluates to a noun.

an expression consists of a literal noun (expressed as a sequence of alphebetic characters or if it is a number, numerical characters), a binary operation, or a unary operation. unary operators prefix the expression they operate upon and are higher precedence than binary operators. binary operators appear between the expressions they operate upon and are right-associative. parenthesis can be used to explicitly group expressions.

"quotations" are a special type of literal noun which refer to statements or sequences of text themselves. there are two types of quotations. a bracket quotation is surrounded in square brackets, and must contain within it a syntactically valid CR document. a normal quotation is enclosed in double quotes and may contain anything of any syntactic validity or language. however, a normal quotation must be properly escaped. the only escape sequences available in a normal quotation are \\ and \".

lambdas are another special type of literal noun. they are first-class functions. they consist of a document enclosed in {}.

described in EBNF

alpha = ? [a-z][A-Z] ? ;
num = ? [0-9] ? ;
ws = { ? whitespace characters ? } ;

name = alpha , { alpha }

literal = name | num , { num } | quote | lambda ;

relop = [ "\" ] , ? relation operator, see § relation operators ? ;
binop = ? binary operator, see § other operators ? ;
unop = ? unary operator, see § other operators ? ;

operation = unop , ws , expr
    | ( literal | "(" , ws, expr , ")", ws ) , ( binop | relop ) , ws , expr ;

assignment = name , ws , "::=" , ws , expr , ws | ":_" , ws , expr , ws ;

expr = assignment | literal | operation | "(" , ws , expr , ")" , ws ;

document = ws , { expr | assignment } ;

quote char = "\\" , ? any character ? | ? any character except double quotes ? ;
normal quote = "\"" , { quote char } , "\"" ;

bracket quote = "[" , document , "]" ;

quote = normal quote | bracket quote ;

lambda = "{" , document , "}" ;

the meaning of a noun

the meaning of literal nouns (which are not quotations or numbers) is determined thusly (in this exact order):

  1. if the meaning of the literal noun, is defined in this standard's noun list, then the meaning of the noun is according to the list.
  2. if the meaning of the literal noun has been defined previously via assignment (::=), then the meaning of the noun is according to that definition. the scope of definition and usage must be considered. see § lambdas.
  3. the meaning of the literal noun must be determined from context, e.g. it is the name of a person.

it is recommended that nonstandard nouns (nouns defined via step #2 or #3) are initially capitalized to distinguish them from standard nouns, which will never be capitalized. however, this is just proposed convention and is not required to conform to the standard.

numerical literal nouns refer to the numbers themselves, such that, for instance, 2#_g would mean "two people".

assignment

an assignment expression Name::=A redefines the name supplied (Name) such that its value is A the remainder of the document after its appearance or for other applicable documents. :_A is equivalent to X::=A.

the value of an assignment expression is az as defined in the word list.

the meaning of a sentence

a sentence consists of a single expression. each expression evaluates to a noun, and so to find the meaning of a sentence, the expression is evaluated. if the expression's meaning is X, then the meaning of the sentence is "there exists X".

CR makes no distinction between statements such as "the someone's thought exists" and "the/a person is thinking". both would be:

*g>:f

the meaning of a CR document is determined by evaluating its sentences in order.

lists

a list is a special type of noun. they contain any amount of nouns in a specific order, including lists themselves. certain operators expect lists as operands. if a nonlist is passed to these operators, then the operand is treated as a list with that noun as its only element. lists can be composed with the , operator. it is similar to a "cons" operation. it appends the first operand to the second operand, which is assumed to be a list.

lists can be interpreted semantically as meaning all of its elements in order. for example, the sentence A,B,C means that there exists A, then B, then C, which indicates that they happen in order.

a noun may semantically refer to a list or collection of things in reality. however, a noun is only a CR list if it is the result of an operation which is defined to produce a list. a list shall have a well-defined finite order, size, and elements independent of the semantics of the nouns in the document.

lambdas

a lambda is a special type of noun representing a CR document. the @ operator is used to apply lambdas to arguments. to evaluate a lambda, the noun X is assigned to the argument within the scope of the lambda. the document is then evaluated. the last sentence of a lambda does not have the meaning of a normal sentence. instead, its expression is evaluated, and the lambda application evaluates to this result.

lambdas are lexically scoped. scope affects the behavior of the ::= operator. a noun's definition according to this operator is the definition or redefinition in the innermost scope that encloses its usage. a lambda's scope is that in which it is defined. lambdas are evaluated within the scope of their initial definition.

this example illustrates the scoping behavior of lambdas:

L::={Y::=X{Y}}A=A@B@L

the inner lambda {Y} is able to access a definition from its outer lambda after it is applied to the argument B.

if a nonlambda is supplied as an operand whose operator assumes it to be a lambda, this is an error.

relation operators

a binary operator expresses relation between the value of its left-hand side, X and its right-hand side, Y. the value of a binary operator expression expressing some relation R is "Y which have/has relation R to X". however, when \ is prepended to the operator, the meaning is changed to "X to which Y have/has relation R". for instance, while B>_A means "A via B", B\>_A means "B which A is via".

in the following definition *A is to be interpreted as "some specific instance(s) of A".

X=Y

X is the same thing as Y

X==Y

X is identical to Y

X>Y

X causes *Y

X>:Y

X is manifesting *Y, embodying it (intentionally)

X>_Y

Y is via X

X<Y

X directly affects Y

X?Y

Y exists if X exists

X/Y

Y which is located in/on/at *X

X%Y

Y concerns/pertains to/is about X

X~Y

Y is similar to/like/as X

X$Y

Y is the conduit of/embodies X

X#_Y

the number of Y is X

X*/Y

Y is composed of X

X\Y

Y is subject to the conditions X

X?/Y

Y exists according to/in the perspective of *X

other operators

the following operators evaluate as defined:

X@Y

the result of the application of the lambda Y to the argument X. see § lambdas.

X@,Y

a list containing the list Y's values with the lambda X applied to them, in order.

X@/Y

all results of the lambda Y applied to each instance of X

X,Y

a list containing X followed by the elements of list Y

X&Y

X and Y

X^Y

X xor Y

X|Y

X and/or Y

*X

some specific instance(s) of X

*:X

all instances of X

&:X

the category which X identifies member(s) of; such that &:*X is equivalent to X

!X

nothing that is X or *X

!!:X

X; this operator emphasizes X in the sentence

?:X

the truth value of the statetment "there exists X"

?;X

a hypothetical/possible X

#X

the amount of X which exist; or, if X is a list: the amount of items in list X

&,X

all of the elements of list X

clarification: the meaning of *X

the difference between *X and X can be thought of like this: if X is "dog"/"dogs", then *X is "some dogs" or "a dog". the difference becomes quite relevant when one performs definitions.

if one makes the definition X::=a, then X is exactly the same thing as a. any usage of X would be identical to using a, which means that this definition wouldn't be very useful. instead, you can define X as an instance of a and then make statements about it, for instance X::=*a i>:X would mean that X is a specific something, and that something is something you did.