로딩중...
검색중...
일치하는것 없음
by::expander 클래스 참조

Visitor for expanding generic types and expressions 더 자세히 ...

#include <expander.hpp>

by::expander에 대한 상속 다이어그램 :
by::visitor by::tworker< void, node >

Public 멤버 함수

void rel () override
 
nbool onVisit (const visitInfo &i, defAssignExpr &me, nbool) override
 
nbool onVisit (const visitInfo &i, asExpr &me, nbool) override
 
nbool onVisit (const visitInfo &i, obj &me, nbool) override
 
void onLeave (const visitInfo &i, obj &me, nbool) override
 
nbool onVisit (const visitInfo &i, func &me, nbool) override
 
void onLeave (const visitInfo &i, func &me, nbool) override
 
nbool onVisit (const visitInfo &i, baseFunc &me, nbool) override
 
void onLeave (const visitInfo &i, baseFunc &me, nbool) override
 
nbool onVisit (const visitInfo &i, getGenericExpr &me, nbool) override
 
- by::visitor(으)로부터 상속된 Public 멤버 함수
 visitor (nbool isReturnable)
 
void setReturnable (nbool isReturnable)
 
nbool isReturnable () const
 
virtual void visit (const visitInfo &i, node &me)
 
virtual nbool onVisit (const visitInfo &i, node &me, nbool alreadyVisited)
 
virtual void onLeave (const visitInfo &i, node &me, nbool alreadyVisited)
 
virtual void onTraverse (const visitInfo &i, node &me)
 
virtual void onTraverse (const visitInfo &i, asExpr &a)
 
virtual void onTraverse (const visitInfo &i, assignExpr &a)
 
virtual void onTraverse (const visitInfo &i, blockExpr &b)
 
virtual void onTraverse (const visitInfo &i, defVarExpr &d)
 
virtual void onTraverse (const visitInfo &i, FBOExpr &f)
 
virtual void onTraverse (const visitInfo &i, getExpr &e)
 
virtual void onTraverse (const visitInfo &i, retExpr &b)
 
virtual void onTraverse (const visitInfo &i, evalExpr &e)
 
virtual void onTraverse (evalExpr &e, node &subject)
 
virtual void onTraverse (const visitInfo &i, func &f)
 
virtual void onTraverse (const visitInfo &i, frame &f)
 
virtual void onTraverse (const visitInfo &i, forExpr &f)
 
virtual void onTraverse (const visitInfo &i, retStateExpr &r)
 
virtual void onTraverse (const visitInfo &i, ifExpr &f)
 
virtual void onTraverse (const visitInfo &i, whileExpr &w)
 
virtual void onTraverse (const visitInfo &i, defArrayExpr &d)
 
virtual void onTraverse (const visitInfo &i, defNestedFuncExpr &e)
 
virtual void onTraverse (const visitInfo &i, genericOrigin &g)
 
virtual void onTraverse (const visitInfo &i, obj &o)
 
- by::tworker< void, node >(으)로부터 상속된 Public 멤버 함수
 tworker (const errReport &rpt)
 
errReportgetReport ()
 
const errReportgetReport () const BY_CONST_FUNC(getReport()) me &setReport(errReport &rpt)
 
me & setFlag (nint newFlag)
 
me & addFlag (nint flag)
 
me & delFlag (nint clear)
 
nbool isFlag (nint flag) const
 
nint getFlag () const
 
me & setTask (const node &root)
 
me & setTask (const node *it) BY_SIDE_FUNC(it
 
nodegetTask ()
 
const nodegetTask () const BY_CONST_FUNC(getTask()) virtual void rel()
 
void work ()
 
const areagetArea () const BY_CONST_FUNC(_getArea()) nbool isOk() const
 

Protected 멤버 함수

void _onWork () override
 
- by::visitor(으)로부터 상속된 Protected 멤버 함수
void _onWork () override
 
void _prepare () override
 Protected virtual method for preparation before starting the work.
 
- by::tworker< void, node >(으)로부터 상속된 Protected 멤버 함수
void _report (baseErr *e)
 
virtual void _onEndWork ()
 Protected virtual method called after the work is completed.
 
area_getArea ()
 
void _onEndErrReport (const errReport &rpt) const
 

추가로 상속된 멤버들

- by::tworker< void, node >(으)로부터 상속된 Public 타입
enum  logFlag
 
- by::tworker< void, node >(으)로부터 상속된 Public 속성
me setTask it
 
me setTask * this
 

상세한 설명

Visitor for expanding generic types and expressions

As mentioned in parser, the current prior type inference algorithm doesn't create dependency graphs but collects all prior type inference expressions and repeatedly attempts type inference. Since this approach is used, it's not suitable to perform the operation of repeatedly traversing expressions and attempting prior type inference all at once inside verifier. Therefore, it's necessary to complete prior type inference with expander before verifying with verifier.

Basic operation is based on visitor, so it's good to understand visitor beforehand.

Definition of Expressions Needing Type Inference

Basically, this applies to all expressions where the user did not specify a type. However, not all expressions without type specification are handled. Prior type inference is only needed when there is no type and the symbol exists in an obj scope. Consider the following byeol code example:

age := 57 # 1) type inference
foo() int
name := "kniz" # 2) also type inference
return name.len()
Definition tnarr.hpp:9

Both age in 1 and name in 2 need type inference, but only 1 performs prior type inference. This is because 2 has no influence. That is, since name inside the foo() function is a local variable, it's sufficient for verifier to perform type inference inside the foo() function.

Prior Type Inference Algorithm

When parser encounters an expression (property or function) that needs prior type inference, it puts the expression into a function called @expand of the object it belongs to. expander traverses all given root origin obj through visitor, checking if the @expand function exists. When it exists, it creates context to use during expansion and adds it to _stack.

After all visitation ends, it performs prior type inference through the following process:

  1. If _stack is empty, terminate type inference
  2. For all _stack elements, prepare frame and verify the expression with verifier
  3. If verification succeeds, complete type inference through eval()
  4. If it fails, move to the next element
  5. When type inference is attempted once for all elements, if even 1 succeeded, return to step 1

Type Convergence

For optimization purposes, during visitation for prior type inference, it performs the operation of replacing getExpr with origin objects, which is called type convergence. During convergence, sometimes replacement to origin is immediately possible, but sometimes replacement is only possible after prior type inference is completed. If getExpr is not replaced with origin during visitation, it's stored in _cons and replacement is attempted once after type inference is completed. Even in this case, if it fails, it's just ignored and no error occurs.

멤버 함수 문서화

◆ _onWork()

void by::expander::_onWork ( )
overrideprotectedvirtual

이 클래스에 대한 문서화 페이지는 다음의 파일로부터 생성되었습니다.:
to Top