Skip to content

Assess if we could access the GDScript AST and debugger/inside info #1281

@NathanLovato

Description

@NathanLovato

This task is about assessing what it'd take to expose the gdscript AST and access stack values like the debugger does for inspecting student code.

We have this problem where we need to check in the code that the student has written that certain identifiers are there and we rely on regular expressions for this, or sometimes on a partial "mini tokenizer".

In the past we have considered exposing the GDScript parser AST, but decided it was too much work at the time given how much we had to do on this FOSS app. Now that we have had more time, I'd like to revisit this idea and see if it'd be possible for us to expose some APIs to:

  • Get the parsed AST
  • Read runtime values

There's a whole class of issues that people otherwise encounter that create a bit of friction that can only be solved through parsing and reading values. E.g. if a student writes:

func _process(delta):
    var speed = 500
    move(speed * delta)

ideally in a practice test that verifies that a character moves at a certain speed and that the code is time dependent, I would need to verify that delta is used in the correct place and perhaps that the speed is a certain amount. Once we get farther in our curriculum, we just tell students to use properties, but in Learn GDScript, people are too early in their learning for that.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions