Node
Some instructions forbid certain ways of answering, such as "solve it without a loop". The teacher checks them while marking, by reading what the pupil wrote.
They do not read it as one long string of words. They split it into parts inside parts: the whole answer, each piece of it, each sentence inside a piece. This page is about any one of those parts. They see only what the pupil wrote, nothing of the aids. These instructions stop nobody from doing anything forbidden.
What it is
A node in an abstract syntax tree is one syntactic construct. The tree is abstract because it drops what does not affect meaning, such as whitespace, and keeps the structure.
The essential difference from the architecture layer: an AST node comes from source, not bytecode. So it can see things the compiler discards, such as which loop construct was written, and it cannot see anything for which no source is available.
In Ares 2
The api/ast package uses this to make structural assertions about how
student code is written, rather than about what it may do at runtime. That answers a
different kind of exercise requirement: did they use recursion, rather than
may they open this file.
Further reading
- JavaParser — project site
- Introduction to JavaParser — Baeldung
- The Java Language Specification, Java SE 21 — Oracle