xo-expression type-inference [wip]
This commit is contained in:
parent
190a21e2f7
commit
16c08b2f96
3 changed files with 90 additions and 0 deletions
16
xo-expression/doc/notes.rst
Normal file
16
xo-expression/doc/notes.rst
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
Random notes.
|
||||
|
||||
Type inference.
|
||||
|
||||
Expressions represent parsed abstract syntax trees.
|
||||
We use the same data structure to represent syntax trees both before and after
|
||||
type inference.
|
||||
|
||||
We record each Expression's type using a type_ref instance.
|
||||
A type_ref does two things:
|
||||
1. gives the expression's type a unique name
|
||||
2. records expression's concrete type once type infrerence has completed.
|
||||
|
||||
Type inference resolves each Expression's type to a concrete TypeDescr.
|
||||
An Expression tree can't be compiled unless all reachable Expression nodes
|
||||
are resolved to concrete types, i.e. type inference has completed successfully.
|
||||
21
xo-expression/include/xo/expression/typeinf/type_ref.hpp
Normal file
21
xo-expression/include/xo/expression/typeinf/type_ref.hpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/** @file type_ref.hpp **/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
using type_var = xo::flatstring<11>;
|
||||
|
||||
/** @class type_ref
|
||||
* @brief name and eventual resolution for type associated with an expression.
|
||||
*
|
||||
*
|
||||
**/
|
||||
struct type_ref {
|
||||
|
||||
|
||||
};
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/** end type_ref.hpp **/
|
||||
Loading…
Add table
Add a link
Reference in a new issue