Skip to content

Commit

Permalink
feat: document lazy systems and parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
zaucy committed Jul 5, 2024
1 parent 1e2ba02 commit b275628
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions src/app/docs/lang/lang.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,30 @@ <h2 id="syntax">Syntax</h2>
*/
</code></pre>

<h3 id="parameters">Parameters</h3>
<p>
Statements may optionally have <em>parameters</em>. Parameters start with
the <code>(</code> character and end with the <code>)</code> character.
Each parameter has a <code>name</code> and a <code>value</code>.
</p>

<pre><code ecsactLangSyntax>
// statement with 1 parameter
statement(name: value);

// parameters are allowed on block statements as well
statement(name: value, name_two: value_two) {{'{}'}}

statement(name); // 'value' is `true` because it was ommitted
statement(name: true); // this is equivalent to the above
</code></pre>

<p>
Parameters are part of the syntax of the Ecsact language, but that doesn't
mean all statements allow all parameters. It is an error to give a statement
a parameter it does not support.
</p>

<h3 id="top-level-statements">Top Level Statements</h3>
<p>Top level statements are separated into 3 sections.</p>
<ol>
Expand Down Expand Up @@ -239,6 +263,7 @@ <h3 id="actions">Actions</h3>
{{'}'}}
</code></pre>


<h3 id="anonymous-systems">Anonymous Systems</h3>
<p>
Systems that have a
Expand All @@ -262,6 +287,26 @@ <h3 id="anonymous-systems">Anonymous Systems</h3>
directly during system execution.
</p>

<h3 id="lazy-systems">Lazy Systems</h3>
<p>
Systems can be marked as <em>lazy</em> with the <code>lazy</code>
<a [routerLink]="" fragment="parameters">parameter</a>.
The <code>lazy</code> parameter accepts an integer or a boolean as a value.
The value of the parameter determines how many times a system implementation
may be executed. A value of <code>false</code> or <code>0</code> means the
system is not lazy. A value of <code>true</code> means <code>1</code>.
</p>
<pre><code ecsactLangSyntax>
// Run this expensive system at most 50 times per execution
system(lazy: 50) {{'{'}}
readwrite CollisionBox;
system ExpensiveSystem {{'{'}}
readwrite CollisionBox;
adds Colliding;
{{'}'}}
{{'}'}}
</code></pre>

<h2 id="fields">Fields</h2>
<p>Both components and actions may contain any number of fields</p>
<h3 id="field-types">Field Types</h3>
Expand Down

0 comments on commit b275628

Please sign in to comment.