Ad
  • Custom User Avatar

    Hi,

    Could somebody please explain why code below is not valid and should throw error:

        var f$ocAdSY3Tpb1eMB$SzVylg0yezu $sJP10cUAn8eqvikoKhhZUMK38 Z81_40Hv1sSvoeoi3iZY0UQeSfmt Xo9XkP8XwwVcJiquogmXMrCeF4E
        read f$ocAdSY3Tpb1eMB$SzVylg0yezu
        cmp 100 f$ocAdSY3Tpb1eMB$SzVylg0yezu $sJP10cUAn8eqvikoKhhZUMK38
        ifeq $sJP10cUAn8eqvikoKhhZUMK38 -1
            call mSP3RrLQPuEEpoXMDXnK7TZiD0EBRgdJCcLKuTJ f$ocAdSY3Tpb1eMB$SzVylg0yezu
        end
        ifneq $sJP10cUAn8eqvikoKhhZUMK38 0
            msg "7//77"
        end
        ifeq $sJP10cUAn8eqvikoKhhZUMK38 1
            call PbZ9l_m4S$aTW8jy9eHsKxBTp9p3h '5'
        end
        proc mSP3RrLQPuEEpoXMDXnK7TZiD0EBRgdJCcLKuTJ $$
            b2a $$ $$ Z81_40Hv1sSvoeoi3iZY0UQeSfmt Xo9XkP8XwwVcJiquogmXMrCeF4E
            msg f$ocAdSY3Tpb1eMB$SzVylg0yezu Z81_40Hv1sSvoeoi3iZY0UQeSfmt Xo9XkP8XwwVcJiquogmXMrCeF4E
        end
        proc PbZ9l_m4S$aTW8jy9eHsKxBTp9p3h $_
            a2b $_ $_ $_ $_
            call mSP3RrLQPuEEpoXMDXnK7TZiD0EBRgdJCcLKuTJ $_
        end
    
  • Custom User Avatar

    I've made an incomplete Rust translation. I gave up on translating advanced tests, random tests and the optiming brainfuck interpreter from other languages, since the code is really hard to understand. Nevertheless, it has a complete solution, a basic brainfuck interpreter, all fixed tests and all invalid input tests. Maybe someone else can translate the rest. Or maybe it can be approved as is, so that people can have at least some fun with writing a compiler in Rust. I spent a lot of time on this

  • Custom User Avatar

    Link in description have content removed.

    But I found it here:

    https://www.reddit.com/r/ProgrammerHumor/comments/ba55q2/i_present_you_the_miracle_sort

  • Default User Avatar

    You cannot "import typing" in Python 3.10 when testing.

    Error below:
    Traceback (most recent call last):
    File "/workspace/default/tests.py", line 2, in
    File "/workspace/default/solution.py", line 2, in
    File "/workspace/default/preloaded.py", line 11, in
    File "", line 1027, in _find_and_load
    File "", line 1002, in _find_and_load_unlocked
    File "", line 945, in _find_spec
    File "/workspace/default/.venv/lib/python3.10/site-packages/_distutils_hack/init.py", line 88, in find_spec
    TypeError: str.format() argument after ** must be a mapping, not int

  • Custom User Avatar

    If you didn't intend this to be valid

    var x
    # Same as set x '\n'
    set x '
    '
    
    # Same as msg "A\nmultiline\nstring"
    msg "A
    multiline
    string"
    

    then you should change

    CharElement -> <any characters other than ', ", or \>
        | '\\' | "\'" | '\"'
        | '\n' | '\r' | '\t'
    

    to

    CharElement -> <any characters other than ', ", \, or EOL>
        | '\\' | "\'" | '\"'
        | '\n' | '\r' | '\t'
    
  • Custom User Avatar

    Variables [...] cannot be used before defined.

    At least in Python, this is never tested. Same issue as below. Please either remove the requirement or put it in the Error Handling section and add a test case.

  • Custom User Avatar

    ifeq, ifneq and wneq [...] can appear inside a proc.

    At least in Python, this is never tested. Test cases should be added or the requirement should be removed.

    My current solution fails on such cases locally, but passes all fixed tests before timing out on random tests for unrelated reasons.

  • Default User Avatar

    Is there a limited, unlimited, or undefined number of vars allowed to be defined?

  • Custom User Avatar

    In Python, End before begining a block test contains an unintended syntax error at line 2:

    end
    msg " That's end"
    

    The spec doesn't allow unescaped ' in strings (see String and CharElement definitions). This input should never be tested, because it's not listed in the Error Handling section. My current solution passes this test just because of a lexer error, without recongizing an unmatched end. I suggest changing the code to just

    end
    

    Other languages probably need this fix as well.

  • Custom User Avatar

    In Python, extected and actual outputs from interpreted BF are compared as strings, so error messages from the test framework look like the following:

    'O\r\x06\x01O\r\x0c\x01O\r\x0c\x01' should equal 'O\r\x06\x01O\r\x06\x01\x00\r\x06\x01'

    However, many msgs feature numbers and not strings, and I have to decipher them every time. I suggest also printing expected and actual as lists of ints. Currently, expected is already printed this way:

    Expected output : [79, 13, 6, 1, 79, 13, 6, 1, 0, 13, 6, 1]

    but not actual. So I'm essentially asking to include actual too. Maybe this applies to other languages as well.

  • Custom User Avatar

    Dart 2.14 should be enabled.

  • Custom User Avatar

    What does it do with a proc that uses a variable defined before the proc definition in a call before the variable definition?

    Something like

    var y
    call proc varx y
    msg y
    
    var x
    set x 3
    proc varx out
        set out x
    end
    

    Would that be a variable accessed before definition error because of macro-style rules?

  • Custom User Avatar

    I think there is an error in random tests for C. My solution passes all static tests and a few hundred random tests before causing this error:
    Test Crashed
    Caught unexpected signal: 6

    Maybe there is a memory leak in the random test generator? I tested my solution locally, there are no crashes, Valgrind shows no memory issues and even after running my code in an endless loop ram usage is constant.

  • Custom User Avatar
    • Python new test framework should be used (Refer this & this for more detail)

    • Ruby 3.0 should be enabled (Refer this & this for more detail)

  • Custom User Avatar

    This one is a hell of a journey... :o

    Some typos or suggestions here and there:

    Sample tests: ErrorWhen('Nested produces',""" -> "procedures"?

    From the description (hopping I don't tell you shit x) ):

    • "And it would be better if you were" (prologue)
    • "make sure that the pointer points to the correct cell" (not sure)
    • "while having the same functionality than long long codes." ?
    • "Requirement" (title)
    • "You are given a code that complies with the following specification"
    • "Character literals are just numbers"
    • "The length of a list will always be in range [1,256]."
    • "where C represents a 100-length list"

    In control flow:

    • " Begins a procedure block."

    Error handling:

    • "If any situation mentioned below occured, it just throws anything."
    • "any other invalid forms showing up in the final tests" (?)
    • "Arguments for an instruction are too many or too few" or "the number of arguments for..." ?
    • "Nested produces." ?
    • "End before beginning a block"
    • "Undefined produce" ?
    • "If you are stuck on some instructions, you can view look at (?) the following links."

    About the BF interpreter:

    • use present rather than imperative? (you use present a bit farther in the text)
    • "cells value are wrapped..."
    • "Loops that only contain_s_ ..., return_s_"
    • not sure about what you wanna exactly say with the next part of that sentence (maybe that's on me, tho. I mean: I understand the meaning, but not the sentence itself x) )

    cheers