Skip to content

Commit

Permalink
Add unsigned int types
Browse files Browse the repository at this point in the history
  • Loading branch information
Smit-create committed May 8, 2023
1 parent bf59fb4 commit 9b82234
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/libasr/ASR.asdl
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ expr
| IntegerUnaryMinus(expr arg, ttype type, expr? value)
| IntegerCompare(expr left, cmpop op, expr right, ttype type, expr? value)
| IntegerBinOp(expr left, binop op, expr right, ttype type, expr? value)
| UnsignedIntegerConstant(float re, float im, ttype type)
| UnsignedIntegerUnaryMinus(expr arg, ttype type, expr? value)
| UnsignedIntegerCompare(expr left, cmpop op, expr right, ttype type, expr? value)
| UnsignedIntegerBinOp(expr left, binop op, expr right, ttype type, expr? value)
| RealConstant(float r, ttype type)
| RealUnaryMinus(expr arg, ttype type, expr? value)
| RealCompare(expr left, cmpop op, expr right, ttype type, expr? value)
Expand Down Expand Up @@ -346,6 +350,7 @@ expr

ttype
= Integer(int kind, dimension* dims)
| UnsignedInteger(int kind, dimension* dims)
| Real(int kind, dimension* dims)
| Complex(int kind, dimension* dims)
| Character(int kind, int len, expr? len_expr, dimension* dims)
Expand Down Expand Up @@ -402,6 +407,8 @@ cast_kind
| RealToCharacter
| IntegerToCharacter
| LogicalToCharacter
| UnsignedIntegerToInteger
| IntegerToUnsignedInteger

dimension = (expr? start, expr? length)

Expand Down
6 changes: 5 additions & 1 deletion src/runtime/lpython/lpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from goto import with_goto

# TODO: this does not seem to restrict other imports
__slots__ = ["i8", "i16", "i32", "i64", "f32", "f64", "c32", "c64", "CPtr",
__slots__ = ["i8", "i16", "i32", "i64", "u8", "u16", "u32", "u64", "f32", "f64", "c32", "c64", "CPtr",
"overload", "ccall", "TypeVar", "pointer", "c_p_pointer", "Pointer",
"p_c_pointer", "vectorize", "inline", "Union", "static", "with_goto",
"packed", "Const", "sizeof", "ccallable", "ccallback", "Callable"]
Expand All @@ -18,6 +18,10 @@
"i16": int,
"i32": int,
"i64": int,
"u8": lambda x: x,
"u16": lambda x: x,
"u32": lambda x: x,
"u64": lambda x: x,
"f32": float,
"f64": float,
"c32": complex,
Expand Down

0 comments on commit 9b82234

Please sign in to comment.