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

Create the framework for a Concrete Syntax Tree (CST) for the contents of the script. #10

Closed trystyncote closed 1 year ago

trystyncote commented 1 year ago

I want to create the functionality for a CST to be created and fully understand the contents of the script. This will obviously require restructuring the entire project again, but will set the framework for custom error messages for the script.

Here's an example CST that shows something like what I want:

Module(
    head(
        <contents of head>
    ), 
    body(
        <contents of body>
    )
)

I think this feature would work best if the 'header' and 'body' elements were to return to the project. This will go against Issue #2, but I think that defining proper ordering will be wise.

In the script, there would be no explicit definition of head and body. Instead, it would automatically split the header elements after the HEAD keywords are finished. When the first body element is defined (SET or CREATE/MOVE/DELETE OBJECT), then the script should consider the header section to be concluded automatically. Any HEAD keywords after this should not be passed silently through the program. It should create a custom error.

This should also come with the consequence of proper ordering. If an object has a MOVE element created before it's created, it should raise issue. Same for DELETE before CREATE.

trystyncote commented 1 year ago

Another thought is that the script should raise a warning (not an exception) if an object isn't called with a DELETE keyword. This should not prevent the creation of the video, but it should be raised to remind the user that objects should be deleted.

trystyncote commented 1 year ago

Refer to #21.