Skip to content

Commit

Permalink
lab6
Browse files Browse the repository at this point in the history
  • Loading branch information
ddanilyuk committed Nov 24, 2020
1 parent de0d139 commit 2f2e389
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 5 additions & 3 deletions clangCompiler/Source/Nodes/BinaryOperationNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,20 @@ struct BinaryOperationNode: Node {
case .divide, .divideEqual:
result += "cdq\n"
result += "idiv ebx\n"

case .multiply:
result += "imul eax, ebx\n"

case .greater:
result += "cmp eax, ebx\n"
result += "setg al\n"
result += "movzx eax, al\n"

case .or:
result += "or eax, ebx\n"
// Uncomment for course work
case .minus:
result += "sub eax, ebx\n"
case .minus:
result += "sub eax, ebx\n"

default:
throw CompilerError.invalidOperator(op.rawValue, 0)
Expand Down
4 changes: 0 additions & 4 deletions clangCompiler/Source/Nodes/DoWhileNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ struct DoWhileNode: Node {
func interpret() throws -> String {

var result = String()

// result += "_doWhile_\(DoWhileNode.doWhileNumber):\n"
// result += try block.interpret()
//
// Make do
result += "jmp _doWhile_\(DoWhileNode.doWhileNumber)\n"

Expand Down

0 comments on commit 2f2e389

Please sign in to comment.