Skip to content

Discrepancy/inconsistency between compilers #62

Open
@Rudxain

Description

@Rudxain

all of these test results are from this commit in my branch, but most of it applies to main branch

The following is valid for both the Py transpiler (pyrickroll) and the real-time interpreter, but not for CPP:

takemetourheart
saygoodbye

Terminal:

echo takemetourheart > test.rr
echo saygoodbye >> test.rr
./RickRoll.py -cpp test.rr
Traceback (most recent call last):
  File "/home/rudxain/Documents/GitHub/rickroll-lang/src-py/./RickRoll.py", line 67, in <module>
    main()
  File "/home/rudxain/Documents/GitHub/rickroll-lang/src-py/./RickRoll.py", line 40, in main
    run_in_cpp(args.file)
  File "/home/rudxain/Documents/GitHub/rickroll-lang/src-py/crickroll.py", line 247, in run_in_cpp
    TranslateToCpp(types=tok.t_types, values=tok.t_values)
  File "/home/rudxain/Documents/GitHub/rickroll-lang/src-py/crickroll.py", line 152, in __init__
    raise SyntaxError(f'Exception in line {current_line}: [{self.values[0]}] is neither a keyword nor function\n')
SyntaxError: Exception in line 1: [takemetourheart] is neither a keyword nor function

But this is a syntax error for everyone, except intpr:

takemetourheart saygoodbye

CPP raises the same error as before. But py is different:

echo 'takemetourheart saygoodbye' > test.rr
./RickRoll.py test.rr
Exception in line 1
    if __name__ == "__main__":
                              ^
IndentationError: expected an indented block after 'if' statement on line 1

Even this thing is valid for intpr!

takemetourheart

Also, CPP thinks empty files are a syntax error, even after fixing the content[-1] out-of-bounds access. This happens because int main(){} is not appended

#60 (ignore. this is for GH to link this issue to the PR)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions