You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by Christofer Dutz <ch...@c-ware.de> on 2022/02/22 20:24:39 UTC

[CODE GENERATION] Updates from today

Hi all,

the last few days I was working hard on creating a new C template module based on our latest refactorings. There I noticed I need not only a target type (The type of the expression output) but also the current type when working with expressions. Sebastian stumbled over the same problem in Java. At first, I wanted to pass along the current type but Sebastian convinced me to do it in the mspec parser.

So today we enabled the mspec parser to assign a type to each literal of an expression. This is particularly interesting for variable expressions.

Now in the code-generation we can simply access the type of a variable at every step of the generation process. This will allow simplifying the templates quite a bit.

But the super-awesome side-effect is, that now the parser ensures expressions are valid and you're not referencing properties that don't exist. This will help with developing syntactically and semantically correct protocol specs.

We even thought, that now it would make sense to have a test in every protocol module, which simply tries to parse the mspec and to report errors early.

So much for the update .. I bet 99,99% of our users will not even notice any change ;-)

Chris

Re: [CODE GENERATION] Updates from today

Posted by Lukas Ott <ot...@gmail.com>.
+1 awesome job Chris and Sebastian ! #teamToddy

Am Di., 22. Feb. 2022 um 21:24 Uhr schrieb Christofer Dutz <
christofer.dutz@c-ware.de>:

> Hi all,
>
> the last few days I was working hard on creating a new C template module
> based on our latest refactorings. There I noticed I need not only a target
> type (The type of the expression output) but also the current type when
> working with expressions. Sebastian stumbled over the same problem in Java.
> At first, I wanted to pass along the current type but Sebastian convinced
> me to do it in the mspec parser.
>
> So today we enabled the mspec parser to assign a type to each literal of
> an expression. This is particularly interesting for variable expressions.
>
> Now in the code-generation we can simply access the type of a variable at
> every step of the generation process. This will allow simplifying the
> templates quite a bit.
>
> But the super-awesome side-effect is, that now the parser ensures
> expressions are valid and you're not referencing properties that don't
> exist. This will help with developing syntactically and semantically
> correct protocol specs.
>
> We even thought, that now it would make sense to have a test in every
> protocol module, which simply tries to parse the mspec and to report errors
> early.
>
> So much for the update .. I bet 99,99% of our users will not even notice
> any change ;-)
>
> Chris
>