String to int conversion in ASR
Figure out a clean way to represent and implement string to int conversions in ASR.
Then figure out how to hook it up in LPython.
Discussed at https://lfortran.zulipchat.com/#narrow/stream/311866-LPython/topic/String.20to.20Int.20conversion.
It looks like we already have some support for string to int conversion.
% cat examples/expr2.py
def main():
x: str = "123"
print(int(x))
main()
% python examples/expr2.py
123
% lpython_in_main examples/expr2.py
123
I think we just need to polish the existing support.
@Shaikh-Ubaid I think we should support the conversion mechanism which intrinsic_int uses, for all the integer types we have. My main concern is that doing i32(int("12345")) is counterintuitive.
The conversion mechanism for int needs to be improved too. It currently relies on std::stoi() and fails for anything larger than that. We only have to improve the BigInt library we already have.