Skip to content

Objects

Benedict Albrecht edited this page Jun 2, 2026 · 6 revisions

Objects

Objects are the fundamental building blocks of a Crodox grammar. Every pattern you define

  • a class, a function, a comment - is an object. There are two types: visible and hidden.

At a Glance

graph LR
    subgraph "Visible Objects  <: :>"
        V1["Can be referenced"]
        V2["Appear in dependency graph"]
        V3["Support sub-bodies & references"]
    end

    subgraph "Hidden Objects  <* *>"
        H1["Cannot be referenced"]
        H2["Not in dependency graph"]
        H3["Structural / organizational"]
    end

    style V1 fill:#7b68ee,color:#fff
    style V2 fill:#7b68ee,color:#fff
    style V3 fill:#7b68ee,color:#fff
    style H1 fill:#888,color:#fff
    style H2 fill:#888,color:#fff
    style H3 fill:#888,color:#fff
Loading

Visible Objects <: :>

Visible objects can be referenced by other objects and appear in the dependency graph. Use them for named language constructs.

<:class:> class <<name>> () { <---> } <:>
<:function:> function <<name>> () { <---> } <:>

Key properties:


Hidden Objects <* *>

Hidden objects are structural - they define patterns the parser needs to recognize but don't participate in the dependency graph.

<*comment*> // -->> \n <*>
<*()*> ( <---> ) <*>

Key properties:

  • Have a name between <* and *>
  • Not shown in the dependency graph
  • Ideal for: comments, delimiters, structural brackets

Note: The distinction between visible and hidden objects is not yet fully implemented. Currently, all objects behave like visible objects. This will change in a future version.


Comparison

Feature Visible <: :> Hidden <* *>
Named
Referenceable ✅ *
In dependency graph
Sub-bodies
Variables
Use case Language constructs Structural patterns

* Currently all objects behave as visible. The distinction will be enforced in a future version.


In Practice

In the Basics grammar, all objects are visible:

Object Type Why visible?
import <: :> Needs to be referenceable so imported names can be resolved across files
class <: :> Must appear in the dependency graph so references like C1.F1() can link to it
function <: :> Referenced via dependency selection <<![class|function]name!>>
variable <: :> Must be referenceable for <<'name'>> dependencies like let xxx = zzz
refference <: :> Creates dependency links between objects

If the Basics grammar also handled comments (e.g., // hello world in refFile.txt), those would be hidden objects since they carry no dependency information.

See Analysing a Repository for how these objects appear in a parsed result.


Next: Sub-bodies - Nesting child objects inside parents.

Clone this wiki locally