Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the DSL docs page #146

Merged
merged 1 commit into from
Sep 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 12 additions & 25 deletions docs/dsl.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include .special.rst
.. include:: .special.rst

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is literally at the top of the page. Yikes
https://nuclear.readthedocs.io/en/latest/dsl.html


NUClear DSL
Expand All @@ -10,18 +10,14 @@ On Statements
On statements are used by :ref:`Reactors` wishing to make subscriptions to the :ref:`PowerPlant`. Using this statement,
developers can set the conditions under which desired :ref:`Reactions` will run.

anatomy of an on statement
Anatomy of an on statement
--------------------------
The on statement can be seen as containing three main parts. The DSL Request, the Runtime Arguments, and the Callback.

.. raw:: html

<font color="blue">On<...></font><font color="red">(Runtime, ... )</font><font color="green">.then(function);</font>
<br /><br />
<font color="blue">DSL Request</font><br />

This is :red:`red !` And :blue:`this part is blue`.
:blue:`On<Dsl, Word(s)>`\(:red:`Runtime, Args`).then(:green:`CallbackFunction`);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to use rst, we should actually use it.

Also, that escaped paren is deliberate. It's required after the backtick

:blue:`DSL Request`
-------------------
The DSL request can be fused together through any combination of DSL words. The combination of these words will define
the kind of reaction which is being requested (for example, :ref:`Trigger` will define a reaction that should occur when
a required data type is emitted, while :ref:`Every` will define periodic reactions).
Expand All @@ -30,22 +26,18 @@ For reactions to occur, at least one Binding DSL word should be present in the D
those which are binding are: :ref:`Trigger`, :ref:`With`, :ref:`Every`, :ref:`Always`, :ref:`Startup`, :ref:`Shutdown`,
:ref:`TCP`, :ref:`UDP` and :ref:`Network`

.. raw:: html

<font color="red">Runtime Arguments</font>

:red:`Runtime Arguments`
------------------------
Some DSL words will provide the ability to make changes to the system during runtime. This means that NUClear avoids
the need for a system restart should a configuration, port number, or file need to be changed while the system is
running.

From the provided DSL words, those which take runtime arguments are: :ref:`IO`, :ref:`TCP`, and :ref:`UDP`

.. raw:: html

<font color="green">Callback</font>

:green:`Callback`
-----------------
Finally, the developer can define the callback which will execute when the reaction is triggered during runtime. The
callback can be defined using a C++ lambda function.
callback can be defined using a C++ lambda expression.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACKSHUALLY 🤓

During system runtime, the argument selection for the callback works on the principle of fission, in that the arguments
provided with the callback can be deduced as needed. For example:
Expand Down Expand Up @@ -142,7 +134,7 @@ Always
.. doxygenstruct:: NUClear::dsl::word::Always

Watchdog
`````````
````````
.. doxygenstruct:: NUClear::dsl::word::Watchdog


Expand Down Expand Up @@ -195,14 +187,9 @@ Note that data can be emitted under varying scopes:
Local Emitting
--------------

These emissions send data to the local instance of the NUClear powerplant. There are a number of scopes under which
These emissions send data to the local instance of the NUClear PowerPlant. There are a number of scopes under which
these emissions can take place:

.. todo::

Trent - I need to decide and get consistent on what we will call the powerPlant. Should it be PowerPlant or
powerPlant - what will you prefer
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making an executive decision here


Scope::LOCAL
````````````
.. doxygenstruct:: NUClear::dsl::word::emit::Local
Expand Down
Loading