rusty icon indicating copy to clipboard operation
rusty copied to clipboard

RuSTy fails to compile a simple function block

Open rohanrayan opened this issue 1 year ago • 5 comments

Describe the bug I am trying to compile the following code with RuSTy and it gives an error, could you please let me know how to fix it?

FUNCTION_BLOCK testAddon
    METHOD PUBLIC testmethod : STRING
        VAR_INPUT
            testvar: DWORD;
        END_VAR    
    END_METHOD
END_FUNCTION_BLOCK

error:

thread 'main' panicked at src/codegen/generators/pou_generator.rs:561:22:
internal llvm codegen error: ()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

To Reproduce Copy the code snippet to a .st file (ex: sample.st) try to compile using: plc --ir sample.st

Expected behavior I expect RuSTy to generate an LLVM-IR for this code

rohanrayan avatar May 22 '24 10:05 rohanrayan

hi @rohanrayan , thx for the issue. so far we implemented a language grammar of iec61131-3 from a version that did not support oop (classes and methods). Implementing OOP support (ant therefore also methods) is scheduled for the 2nd half of 2024.

We'll need to postpone this issue a bit, but we'll get there soon.

riederm avatar Jun 06 '24 05:06 riederm

Hi @riederm

Could you let me know which version (or year) of the grammar that is currently supported by RuSTy?

rohanrayan avatar Jul 29 '24 09:07 rohanrayan

Is there any update on this issue? Is there a timeline when I can expect this to be fixed?

Thanks!

rohanrayan avatar Jan 07 '25 10:01 rohanrayan

Hello @rohanrayan, we have support for methods in FB now, but AFAIK without modifiers, could be that we just ignore the modifires. The support is however still in its infancy we don't for example support polymorphism yet and we still have some edge cases in method calls that we want to iron out. The version we aim to support is the 2014 version which includes OOP, we are however focusing more on the codesys variants of OOP for the start

ghaith avatar Jan 08 '25 09:01 ghaith

We started implementation, so within the next few months. We already have methods and interfaces as mentioned, we want to support polymorphism as a next step. namespaces as defined in the norm are not yet a priority but will hopefully come later.

ghaith avatar Jan 08 '25 09:01 ghaith