You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Print is weird. I have a skeleton set up inside the semantic analyzer for it, but we need to nail down its arguments. We have 3 options:
-Let it only take in Strings
-Let it take in any type, and have a new "polymorphic" type to compensate
-Let it keep using printf args, and try to figure out how to type check variadic functions in our own type checker (seems really hard, so lets not do this one)
The text was updated successfully, but these errors were encountered:
So, right now print is set up to be 'psudo-polymorphic'. When the semantic analyzer checks a function call, if the call is named 'print', it handles it specially. If the type is an int, float, char or string, it passes it, otherwise it throws an exception.
In the generator, when it prints the call, if the call is to print, it manually inserts the correct printf statement.
Right now, this only works with ints. If you pull the current code, and run the test suite, the first four or five tests pass. When the suite gets to the 'hello world' test, it fails. I need to go in and add type-checking to the generator, to correctly format the printf statements, which shouldn't be too hard to do. Something similar can be done for other built-in's.
Print is weird. I have a skeleton set up inside the semantic analyzer for it, but we need to nail down its arguments. We have 3 options:
-Let it only take in Strings
-Let it take in any type, and have a new "polymorphic" type to compensate
-Let it keep using printf args, and try to figure out how to type check variadic functions in our own type checker (seems really hard, so lets not do this one)
The text was updated successfully, but these errors were encountered: