On Mon, 2026-05-04 at 09:48 +0200, Nam Cao wrote:
> I am working on converting rvgen to use Lark, a parsing library:
> https://github.com/lark-parser/lark
> 
> This test case breaks the current version of the new script, because
> state_c has no label while the script expects one - the script read the
> state's name from the label.

Right, good point, I forgot to add that.. Thanks for checking!

> We should define if the label or the node's name is our state's
> name. For example, if we have:
> 
>     "state_c" [label = "state_d"];
> 
> Will the state's name be state_c or state_d? Or should that be a parsing
> error?
> 
> I propose using the label if one is provided, otherwise using the node's
> name. So
> 
>     "state_c" [label = "state_d"];
> 
> means the state's name is "state_d". But without that statement, the
> state's name is "state_c".
> 
> What do you think?

Mmh, the only valid usecase I can think for DAs is to tweak the dot
representation, e.g.:

 "state_c" [label = "State C"];

in this case the user might want to have a better display on the graph while
still keeping a valid state name.

Also keep in mind that in HA we could do something like

 "state_c" [label = "state_c\nclk < 10"];

Here it's probably simpler to just parse the node name rather than the label.

Do you have any other reason to prefer "state_d" in your example?

Either way we are opening for confusion (like in your example), so if you
believe throwing an error makes the grammar simpler, we could also go down that
path.

In any case, I would make the label definition mandatory. So my current sample
model is wrong.

> (just FYI, my work-in-progress:
> https://github.com/covanam/linux/commits/rv-lark/)

Thanks for sharing, I'll have a look!

Gabriele


Reply via email to