1
0
kpmy 10 жил өмнө
parent
commit
69b431a2bc

+ 0 - 1
.old/README.md

@@ -1 +0,0 @@
-remove after 20150101 

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 1
.old/fw/PrivDemo1.oxf


+ 0 - 27
.old/fw/fw.go

@@ -1,27 +0,0 @@
-package main
-
-import (
-	"os"
-	"rt"
-	"xev"
-)
-
-func main() {
-	path, _ := os.Getwd()
-	ret := xev.Load(path, "PrivDemo1.oxf")
-	if ret != nil {
-		p := rt.NewProcessor()
-		err := p.ConnectTo(ret)
-		if err != nil {
-			panic("not connected")
-		}
-		for {
-			res, _ := p.Do()
-			if res != rt.OK {
-				break
-			}
-		}
-	} else {
-		panic("no module")
-	}
-}

+ 0 - 65
.old/rt/heap.go

@@ -1,65 +0,0 @@
-package rt
-
-import (
-	"cp/object"
-	"fmt"
-	"reflect"
-)
-
-type INTEGER int
-
-type Variable interface {
-	Set(interface{})
-}
-
-func (i *INTEGER) Set(val interface{}) {
-	if val == nil {
-		panic("cannot be nil")
-	}
-	switch val.(type) {
-	case int:
-		*i = INTEGER(val.(int))
-	case INTEGER:
-		*i = val.(INTEGER)
-	case *INTEGER:
-		*i = *val.(*INTEGER)
-	default:
-		fmt.Print(reflect.TypeOf(val), " ")
-		panic("wrong type for INTEGER")
-	}
-	fmt.Println("set", int(*i))
-}
-
-type Heap interface {
-	This(obj object.Object) Variable
-}
-
-type stdHeap struct {
-	inner map[interface{}]interface{}
-}
-
-func NewHeap() Heap {
-	return new(stdHeap).Init()
-}
-
-func (h *stdHeap) Init() *stdHeap {
-	h.inner = make(map[interface{}]interface{}, 0)
-	return h
-}
-
-func (h *stdHeap) This(obj object.Object) (ptr Variable) {
-	p := h.inner[obj]
-	if p == nil {
-		switch obj.Type() {
-		case object.INTEGER:
-			ptr = new(INTEGER)
-			h.inner[obj] = ptr
-		default:
-			fmt.Println(obj.Type())
-			panic("unknown object type")
-		}
-	} else {
-		ptr = p.(Variable)
-	}
-	return ptr
-}

+ 0 - 28
.old/rt/op.go

@@ -1,28 +0,0 @@
-package rt
-
-import (
-	"fmt"
-	"reflect"
-)
-
-func intOf(x interface{}) (a int) {
-	fmt.Println(reflect.TypeOf(x))
-	switch x.(type) {
-	case *INTEGER:
-		z := *x.(*INTEGER)
-		a = int(z)
-	case *int:
-		z := *x.(*int)
-		a = z
-	case int:
-		a = x.(int)
-	default:
-		panic("unsupported type")
-	}
-	return a
-}
-func Sum(_a interface{}, _b interface{}) interface{} {
-	var a int = intOf(_a)
-	var b int = intOf(_b)
-	return a + b
-}

+ 0 - 160
.old/rt/proc.go

@@ -1,160 +0,0 @@
-package rt
-
-import (
-	"cp/constant/enter"
-	"cp/module"
-	"cp/node"
-	"errors"
-	"fmt"
-	"reflect"
-)
-
-type Result int
-
-const (
-	OK Result = iota
-	END
-	ERROR
-)
-
-type Processor interface {
-	ConnectTo(mod *module.Module) error
-	Do() (Result, error)
-}
-
-type Sequence interface {
-	Do(f *frame) Wait
-}
-
-func NewProcessor() Processor {
-	return new(procImpl).Init()
-}
-
-type frame struct {
-	p      *procImpl
-	parent *frame
-	ir     node.Node
-	seq    Sequence
-	ret    map[node.Node]interface{}
-}
-
-func (f *frame) Do() (wait Wait) {
-	if f.seq == nil {
-		panic("no sequence")
-	}
-	return f.seq.Do(f)
-}
-
-func (f *frame) OnPush() {
-	switch f.ir.(type) {
-	case node.AssignNode:
-		f.ret = make(map[node.Node]interface{}, 2)
-		f.seq = new(assignSeq)
-	case node.OperationNode:
-		f.ret = make(map[node.Node]interface{}, 3)
-		f.seq = new(opSeq)
-	case node.CallNode:
-		f.seq = new(callSeq)
-	case node.EnterNode:
-		if f.ir.(node.EnterNode).Enter() == enter.PROCEDURE {
-			fmt.Println("proc")
-		} else {
-			panic("cannot enter to module")
-		}
-		f.seq = new(enterSeq)
-	default:
-		fmt.Println(reflect.TypeOf(f.ir))
-		panic("unknown ir")
-	}
-}
-
-func (f *frame) OnPop() {
-	switch f.ir.(type) {
-	case node.AssignNode:
-		if f.ir.Link() != nil {
-			f.p.stack.Push(NewFrame(f.p, f.ir.Link()))
-		}
-	case node.OperationNode:
-		f.parent.ret[f.ir] = f.ret[f.ir]
-	case node.CallNode:
-		if f.ir.Link() != nil {
-			f.p.stack.Push(NewFrame(f.p, f.ir.Link()))
-		}
-	}
-}
-
-func (f *frame) push(t *frame) {
-	t.parent = f
-	f.p.stack.Push(t)
-}
-
-func NewFrame(p *procImpl, ir node.Node) Frame {
-	f := new(frame)
-	f.ir = ir
-	f.p = p
-	return f
-}
-
-type procImpl struct {
-	stack   Stack
-	heap    Heap
-	cycle   int64
-	thisMod *module.Module
-}
-
-func (p *procImpl) Init() *procImpl {
-	p.stack = NewStack()
-	p.heap = NewHeap()
-	return p
-}
-
-func (p *procImpl) ConnectTo(mod *module.Module) (err error) {
-	p.thisMod = mod
-	head := p.thisMod.Enter
-	if head != nil {
-		switch head.(type) {
-		// особый случай, после enter вправо, а не вниз
-		case node.EnterNode:
-			p.stack.Push(NewFrame(p, head.Right()))
-		default:
-			panic("oops")
-		}
-	} else {
-		err = errors.New("not a head node")
-	}
-	return err
-}
-
-func (p *procImpl) Do() (res Result, err error) {
-	if p.stack.Top() != nil {
-		p.cycle++
-		f := p.stack.Top()
-		//цикл дейкстры
-		for {
-			wait := f.Do()
-			fmt.Println(wait)
-			if wait == SKIP {
-				break
-			} else if wait == DO {
-			} else if wait == WRONG {
-				panic("something wrong")
-			} else {
-				if f == p.stack.Top() {
-					p.stack.Pop()
-				} else {
-					panic("do not stop if not top on stack")
-				}
-				break
-			}
-		}
-	} else {
-		err = errors.New("no program")
-	}
-	if p.stack.Top() != nil {
-		res = OK
-	} else {
-		res = END
-		fmt.Println(p.heap)
-	}
-	return res, err
-}

+ 0 - 164
.old/rt/seq.go

@@ -1,164 +0,0 @@
-package rt
-
-import (
-	"cp/constant/operation"
-	"cp/node"
-	"cp/object"
-	"cp/statement"
-)
-
-type assignSeq struct {
-	step func() Wait
-}
-
-func (s *assignSeq) Do(f *frame) (ret Wait) {
-	a := f.ir.(node.AssignNode)
-	assign := func() Wait {
-		switch f.ir.Left().(type) {
-		case node.VariableNode:
-			f.ret[f.ir.Left()] = f.ir.Left().Object()
-			s.step = func() Wait {
-				switch f.ir.Right().(type) {
-				case node.ConstantNode:
-					f.ret[f.ir.Right()] = f.ir.Right().(node.ConstantNode).Data()
-					s.step = func() Wait {
-						a := f.p.heap.This(f.ret[f.ir.Left()].(object.Object))
-						a.Set(f.ret[f.ir.Right()])
-						return STOP
-					}
-					return DO
-				case node.OperationNode:
-					nf := NewFrame(f.p, f.ir.Right()).(*frame)
-					f.push(nf)
-					s.step = func() Wait {
-						a := f.p.heap.This(f.ret[f.ir.Left()].(object.Object))
-						a.Set(f.ret[f.ir.Right()])
-						return STOP
-					}
-					return SKIP
-				case node.VariableNode:
-					a := f.p.heap.This(f.ir.Right().Object())
-					b := f.p.heap.This(f.ret[f.ir.Left()].(object.Object))
-					b.Set(a)
-					return STOP
-				default:
-					panic("wrong right")
-				}
-			}
-			return DO
-		default:
-			panic("wrong left")
-		}
-	}
-	if s.step == nil {
-		ret = DO
-		switch a.Statement() {
-		case statement.ASSIGN:
-			s.step = assign
-		default:
-			panic("unknown assign subclass")
-		}
-	} else {
-		ret = s.step()
-	}
-	return ret
-}
-
-type opSeq struct {
-	step func() Wait
-}
-
-func (s *opSeq) Do(f *frame) (ret Wait) {
-	_ = f.ir.(node.OperationNode)
-	op := func() Wait {
-		switch f.ir.(node.OperationNode).Operation() {
-		case operation.PLUS:
-			a := f.ret[f.ir.Left()]
-			b := f.ret[f.ir.Right()]
-			f.ret[f.ir] = Sum(a, b)
-			return STOP
-		default:
-			panic("unknown operation")
-		}
-	}
-	right := func() Wait {
-		switch f.ir.Right().(type) {
-		case node.ConstantNode:
-			f.ret[f.ir.Right()] = f.ir.Right().(node.ConstantNode).Data()
-			s.step = op
-			return DO
-		case node.VariableNode:
-			s.step = func() Wait {
-				f.ret[f.ir.Right()] = f.p.heap.This(f.ir.Right().Object())
-				s.step = op
-				return DO
-			}
-			return SKIP
-		default:
-			panic("wrong right")
-		}
-	}
-	left := func() Wait {
-		switch f.ir.Left().(type) {
-		case node.ConstantNode:
-			f.ret[f.ir.Left()] = f.ir.Left().(node.ConstantNode).Data()
-			s.step = right
-			return DO
-		case node.VariableNode:
-			s.step = func() Wait {
-				f.ret[f.ir.Left()] = f.p.heap.This(f.ir.Left().Object())
-				s.step = right
-				return DO
-			}
-			return SKIP
-		default:
-			panic("wrong left")
-		}
-	}
-	if s.step == nil {
-		s.step = left
-		ret = DO
-	} else {
-		ret = s.step()
-	}
-	return ret
-}
-
-type callSeq struct {
-	step func() Wait
-}
-
-func (s *callSeq) Do(f *frame) Wait {
-	if s.step == nil {
-		switch f.ir.Left().(type) {
-		case node.ProcedureNode:
-			proc := f.p.thisMod.NodeByObject(f.ir.Left().Object())
-			f.push(NewFrame(f.p, proc).(*frame))
-			s.step = func() Wait {
-				return STOP
-			}
-			return SKIP
-		default:
-			panic("unknown call left")
-		}
-	} else {
-		return s.step()
-	}
-}
-
-type enterSeq struct {
-	step func() Wait
-}
-
-func (e *enterSeq) Do(f *frame) Wait {
-	if e.step == nil {
-		//for f.ir == EnterNode entering to .Right()
-		f.push(NewFrame(f.p, f.ir.Right()).(*frame))
-		e.step = func() Wait {
-			return STOP
-		}
-		return SKIP
-	} else {
-		return e.step()
-	}
-}

+ 0 - 77
.old/rt/stack.go

@@ -1,77 +0,0 @@
-package rt
-
-import "container/list"
-
-type Wait int
-
-const (
-	WRONG Wait = iota
-	SKIP
-	STOP
-	DO
-)
-
-type Stack interface {
-	Push(frame Frame)
-	Pop() Frame
-	Top() Frame
-}
-
-type Frame interface {
-	Do() (wait Wait)
-	OnPush()
-	OnPop()
-}
-
-func NewStack() Stack {
-	return new(stdStack).Init()
-}
-
-type stdStack struct {
-	inner list.List
-}
-
-func (s *stdStack) Init() *stdStack {
-	s.inner = *list.New()
-	return s
-}
-
-func (s *stdStack) Push(frame Frame) {
-	s.inner.PushFront(frame)
-	frame.OnPush()
-}
-
-func (s *stdStack) Pop() (frame Frame) {
-	if s.inner.Front() != nil {
-		elem := s.inner.Front()
-		frame = elem.Value.(Frame)
-		s.inner.Remove(elem)
-		frame.OnPop()
-	} else {
-		panic("it's empty stack")
-	}
-	return frame
-}
-
-func (s *stdStack) Top() (frame Frame) {
-	elem := s.inner.Front()
-	if elem != nil {
-		frame = elem.Value.(Frame)
-	}
-	return frame
-}
-
-func (w Wait) String() string {
-	switch w {
-	case DO:
-		return "DO"
-	case SKIP:
-		return "SKIP"
-	case STOP:
-		return "STOP"
-	case WRONG:
-		return "WRONG"
-	default:
-		panic("wrong wait value")
-	}
-}

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
XevDemo5.oxf


+ 1 - 0
cp/constant/nodeclass.go

@@ -16,4 +16,5 @@ const (
 	CONDITIONAL
 	IF
 	WHILE
+	REPEAT
 )

+ 1 - 0
cp/constant/operation/operation.go

@@ -4,6 +4,7 @@ type Operation int
 
 const (
 	PLUS Operation = iota
+	MINUS
 	CONVERT
 	EQUAL
 	LESSER

+ 62 - 75
cp/node/class.go

@@ -1,88 +1,69 @@
 package node
 
 import (
+	"fw/cp/constant"
 	"fw/cp/constant/enter"
 	"fw/cp/constant/operation"
 	"fw/cp/object"
 	"fw/cp/statement"
 )
 
-type EnterNode interface {
-	Enter() enter.Enter
-	SetEnter(enter enter.Enter)
-	Node
-}
-
-type OperationNode interface {
-	SetOperation(op operation.Operation)
-	Operation() operation.Operation
-	Node
-}
-
-type ConstantNode interface {
-	SetType(typ object.Type)
-	SetData(data interface{})
-	Data() interface{}
-	Type() object.Type
-	Node
-}
-
-// Self-designator for empty interfaces
-type AssignNode interface {
-	self() AssignNode
-	SetStatement(statement.Statement)
-	Statement() statement.Statement
-	Node
-}
-
-type VariableNode interface {
-	self() VariableNode
-	Node
-}
-
-type CallNode interface {
-	self() CallNode
-	Node
-}
-
-type ProcedureNode interface {
-	self() ProcedureNode
-	Node
-}
-
-type ParameterNode interface {
-	Node
-	self() ParameterNode
-}
+func New(class constant.Class) Node {
+	switch class {
+	case constant.ENTER:
+		return new(enterNode)
+	case constant.ASSIGN:
+		return new(assignNode)
+	case constant.VARIABLE:
+		return new(variableNode)
+	case constant.DYADIC:
+		return new(dyadicNode)
+	case constant.CONSTANT:
+		return new(constantNode)
+	case constant.CALL:
+		return new(callNode)
+	case constant.PROCEDURE:
+		return new(procedureNode)
+	case constant.PARAMETER:
+		return new(parameterNode)
+	case constant.RETURN:
+		return new(returnNode)
+	case constant.MONADIC:
+		return new(monadicNode)
+	case constant.CONDITIONAL:
+		return new(conditionalNode)
+	case constant.IF:
+		return new(ifNode)
+	case constant.REPEAT:
+		return new(repeatNode)
+	case constant.WHILE:
+		return new(whileNode)
+	default:
+		panic("no such class")
+	}
+}
+
+type nodeFields struct {
+	left, right, link Node
+	obj               object.Object
+}
+
+func (nf *nodeFields) SetLeft(n Node) { nf.left = n }
+
+func (nf *nodeFields) SetRight(n Node) { nf.right = n }
+
+func (nf *nodeFields) SetLink(n Node) { nf.link = n }
+
+func (nf *nodeFields) SetObject(o object.Object) { nf.obj = o }
+
+func (nf *nodeFields) Left() Node { return nf.left }
+
+func (nf *nodeFields) Right() Node { return nf.right }
+
+func (nf *nodeFields) Link() Node { return nf.link }
+
+func (nf *nodeFields) Object() object.Object { return nf.obj }
 
-type ReturnNode interface {
-	Node
-	self() ReturnNode
-}
-
-type DyadicNode interface {
-	OperationNode
-	self() DyadicNode
-}
-
-type MonadicNode interface {
-	OperationNode
-	SetType(typ object.Type)
-	Type() object.Type
-	self() MonadicNode
-}
-
-type ConditionalNode interface {
-	self() ConditionalNode
-}
-
-type IfNode interface {
-	self() IfNode
-}
-
-type WhileNode interface {
-	self() WhileNode
-}
 type enterNode struct {
 	nodeFields
 	enter enter.Enter
@@ -189,3 +170,9 @@ type whileNode struct {
 }
 
 func (v *whileNode) self() WhileNode { return v }
+
+type repeatNode struct {
+	nodeFields
+}
+
+func (v *repeatNode) self() RepeatNode { return v }

+ 76 - 43
cp/node/node.go

@@ -1,8 +1,10 @@
 package node
 
 import (
-	"fw/cp/constant"
+	"fw/cp/constant/enter"
+	"fw/cp/constant/operation"
 	"fw/cp/object"
+	"fw/cp/statement"
 )
 
 type Node interface {
@@ -17,56 +19,87 @@ type Node interface {
 	Object() object.Object
 }
 
-func New(class constant.Class) Node {
-	switch class {
-	case constant.ENTER:
-		return new(enterNode)
-	case constant.ASSIGN:
-		return new(assignNode)
-	case constant.VARIABLE:
-		return new(variableNode)
-	case constant.DYADIC:
-		return new(dyadicNode)
-	case constant.CONSTANT:
-		return new(constantNode)
-	case constant.CALL:
-		return new(callNode)
-	case constant.PROCEDURE:
-		return new(procedureNode)
-	case constant.PARAMETER:
-		return new(parameterNode)
-	case constant.RETURN:
-		return new(returnNode)
-	case constant.MONADIC:
-		return new(monadicNode)
-	case constant.CONDITIONAL:
-		return new(conditionalNode)
-	case constant.IF:
-		return new(ifNode)
-	case constant.WHILE:
-		return new(whileNode)
-	default:
-		panic("no such class")
-	}
+type EnterNode interface {
+	Enter() enter.Enter
+	SetEnter(enter enter.Enter)
+	Node
 }
 
-type nodeFields struct {
-	left, right, link Node
-	obj               object.Object
+type OperationNode interface {
+	SetOperation(op operation.Operation)
+	Operation() operation.Operation
+	Node
 }
 
-func (nf *nodeFields) SetLeft(n Node) { nf.left = n }
+type ConstantNode interface {
+	SetType(typ object.Type)
+	SetData(data interface{})
+	Data() interface{}
+	Type() object.Type
+	Node
+}
+
+// Self-designator for empty interfaces
+type AssignNode interface {
+	self() AssignNode
+	SetStatement(statement.Statement)
+	Statement() statement.Statement
+	Node
+}
+
+type VariableNode interface {
+	self() VariableNode
+	Node
+}
+
+type CallNode interface {
+	self() CallNode
+	Node
+}
+
+type ProcedureNode interface {
+	self() ProcedureNode
+	Node
+}
 
-func (nf *nodeFields) SetRight(n Node) { nf.right = n }
+type ParameterNode interface {
+	Node
+	self() ParameterNode
+}
 
-func (nf *nodeFields) SetLink(n Node) { nf.link = n }
+type ReturnNode interface {
+	Node
+	self() ReturnNode
+}
 
-func (nf *nodeFields) SetObject(o object.Object) { nf.obj = o }
+type DyadicNode interface {
+	OperationNode
+	self() DyadicNode
+}
 
-func (nf *nodeFields) Left() Node { return nf.left }
+type MonadicNode interface {
+	OperationNode
+	SetType(typ object.Type)
+	Type() object.Type
+	self() MonadicNode
+}
 
-func (nf *nodeFields) Right() Node { return nf.right }
+type ConditionalNode interface {
+	self() ConditionalNode
+	Node
+}
 
-func (nf *nodeFields) Link() Node { return nf.link }
+type IfNode interface {
+	self() IfNode
+	Node
+}
+
+type WhileNode interface {
+	self() WhileNode
+	Node
+}
 
-func (nf *nodeFields) Object() object.Object { return nf.obj }
+type RepeatNode interface {
+	self() RepeatNode
+	Node
+}

+ 11 - 0
rt2/rules/op.go

@@ -35,6 +35,14 @@ func sum(_a interface{}, _b interface{}) interface{} {
 	return a + b
 }
 
+func sub(_a interface{}, _b interface{}) interface{} {
+	assert.For(_a != nil, 20)
+	assert.For(_b != nil, 21)
+	var a int32 = int32Of(_a)
+	var b int32 = int32Of(_b)
+	return a - b
+}
+
 func eq(_a interface{}, _b interface{}) bool {
 	assert.For(_a != nil, 20)
 	assert.For(_b != nil, 21)
@@ -92,6 +100,9 @@ func dopSeq(f frame.Frame) (seq frame.Sequence, ret frame.WAIT) {
 		case operation.PLUS:
 			fu.DataOf(f.Parent())[n] = sum(fu.DataOf(f)[n.Left()], fu.DataOf(f)[n.Right()])
 			return frame.End()
+		case operation.MINUS:
+			fu.DataOf(f.Parent())[n] = sub(fu.DataOf(f)[n.Left()], fu.DataOf(f)[n.Right()])
+			return frame.End()
 		case operation.EQUAL:
 			fu.DataOf(f.Parent())[n] = eq(fu.DataOf(f)[n.Left()], fu.DataOf(f)[n.Right()])
 			return frame.End()

+ 47 - 0
rt2/rules/repeat.go

@@ -0,0 +1,47 @@
+package rules
+
+import (
+	"fmt"
+	"fw/cp/node"
+	"fw/rt2/frame"
+	"fw/rt2/nodeframe"
+	"reflect"
+)
+
+func repeatSeq(f frame.Frame) (seq frame.Sequence, ret frame.WAIT) {
+	var fu nodeframe.FrameUtils
+	n := fu.NodeOf(f)
+
+	fu.DataOf(f)[n.Right()] = false
+	var cond func(f frame.Frame) (frame.Sequence, frame.WAIT)
+	next := func(f frame.Frame) (frame.Sequence, frame.WAIT) {
+		done := fu.DataOf(f)[n.Right()].(bool)
+		fu.DataOf(f)[n.Right()] = nil
+		if !done && n.Right() != nil {
+			fu.Push(fu.New(n.Left()), f)
+			return cond, frame.LATER
+		} else if done {
+			return frame.End()
+		} else if n.Left() == nil {
+			return frame.End()
+		} else {
+			panic("unexpected repeat seq")
+		}
+	}
+
+	cond = func(f frame.Frame) (frame.Sequence, frame.WAIT) {
+		switch n.Right().(type) {
+		case node.OperationNode:
+			fu.Push(fu.New(n.Right()), f)
+			seq = func(f frame.Frame) (seq frame.Sequence, ret frame.WAIT) {
+				fu.DataOf(f.Parent())[n] = fu.DataOf(f)[n.Right()]
+				return next, frame.LATER
+			}
+			ret = frame.LATER
+			return seq, ret
+		default:
+			panic(fmt.Sprintf("unknown repeat expression", reflect.TypeOf(n.Left())))
+		}
+	}
+	return next, frame.NOW
+}

+ 3 - 1
rt2/rules/table.go

@@ -38,6 +38,8 @@ func prologue(n node.Node) frame.Sequence {
 		return ifExpr
 	case node.WhileNode:
 		return whileSeq
+	case node.RepeatNode:
+		return repeatSeq
 	default:
 		panic(fmt.Sprintln("unknown node", reflect.TypeOf(n)))
 	}
@@ -46,7 +48,7 @@ func prologue(n node.Node) frame.Sequence {
 func epilogue(n node.Node) frame.Sequence {
 	var fu nodeframe.FrameUtils
 	switch n.(type) {
-	case node.AssignNode, node.CallNode, node.ConditionalNode, node.WhileNode:
+	case node.AssignNode, node.CallNode, node.ConditionalNode, node.WhileNode, node.RepeatNode:
 		return func(f frame.Frame) (frame.Sequence, frame.WAIT) {
 			next := n.Link()
 			if next != nil {

+ 1 - 1
rt2/rules/while.go

@@ -39,7 +39,7 @@ func whileSeq(f frame.Frame) (seq frame.Sequence, ret frame.WAIT) {
 			ret = frame.LATER
 			return seq, ret
 		default:
-			panic(fmt.Sprintf("unknown condition expression", reflect.TypeOf(n.Left())))
+			panic(fmt.Sprintf("unknown while expression", reflect.TypeOf(n.Left())))
 		}
 	}
 	return cond, frame.NOW

+ 4 - 0
xev/converter.go

@@ -223,6 +223,8 @@ func (r *Result) buildNode(n *Node) (ret node.Node) {
 			switch n.Data.Nod.Operation {
 			case "plus":
 				ret.(node.OperationNode).SetOperation(operation.PLUS)
+			case "minus":
+				ret.(node.OperationNode).SetOperation(operation.MINUS)
 			case "equal":
 				ret.(node.OperationNode).SetOperation(operation.EQUAL)
 			case "lesser":
@@ -265,6 +267,8 @@ func (r *Result) buildNode(n *Node) (ret node.Node) {
 			ret = node.New(constant.IF)
 		case "while":
 			ret = node.New(constant.WHILE)
+		case "repeat":
+			ret = node.New(constant.REPEAT)
 		default:
 			fmt.Println(n.Data.Nod.Class)
 			panic("no such node type")

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно