Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discrepancy/inconsistency between compilers #62

Open
Rudxain opened this issue Oct 19, 2022 · 0 comments
Open

Discrepancy/inconsistency between compilers #62

Rudxain opened this issue Oct 19, 2022 · 0 comments

Comments

@Rudxain
Copy link
Member

Rudxain commented Oct 19, 2022

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant