Type checking and compilation #253
travispaxton
started this conversation in
General
Replies: 1 comment
-
Hi Travis - No, we're not deferring to Java for type checking. When we compile, we produce a record of each type, called a TypeConstant, and that is used for type checking. It's a huge pile of information (including a tree of sub-classes of TypeConstant, and a separate structure produced from TypeConstant called TypeInfo). The type checking looks like this in IfStatement, where it knows it needs a condition to be a boolean, for example. I gave that as a super simple example, because most type checking is dramatically more complex than that, but it's mostly implemented in the validation stage of the compiler, by the various AST nodes. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I’ve been reading through your docs and looking through the source code. How are you handing type checking? Are you deferring to Java? I see you have a list of op codes and it looks like there’s some Java code that is emitting them, but I’m not quite grasping how you’re compiling.
Beta Was this translation helpful? Give feedback.
All reactions