trystyncote / scripted-video

This is a project that attempts to produce an animation-looking video based on a given script.
MIT License
0 stars 0 forks source link

Upgrade SVST to be more concrete. #22

Closed trystyncote closed 11 months ago

trystyncote commented 1 year ago

The difference between an Abstract Syntax Tree and a Concrete Syntax Tree is that the latter stores enough data to reconstruct the original. An AST only stores the data it needs and ignores things such as whitespace.

In #10, I compared my version to a CST. Instead, I implemented an AST that only stores what is needed. This is not problematic on the surface, but this should be required to find any syntax-related errors.

To implement this feature, I would need to add 'whitespace' attributes and other like attributes that tell about the whitespace more than the details of the concepts being passed in. This also requires tweaking how the regular expressions return an SVST node object.

trystyncote commented 1 year ago

The main reason I would like to do so is because I think using this method would be best for reprinting for the traceback of a qualms.RootPsuedoError type. It could simply reconstruct the command from the whitespace data. This also has a potential secondary benefit of being used to flag stylistic warnings (assuming that it's allowed to).