PLC-lang / rusty

Structured Text Parser and LLVM Frontend
GNU Lesser General Public License v3.0
223 stars 53 forks source link

RuSTy fails to compile a simple function block #1226

Open rohanrayan opened 6 months ago

rohanrayan commented 6 months ago

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

riederm commented 5 months ago

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.

rohanrayan commented 3 months ago

Hi @riederm

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