-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0ce68d
commit 95c4a4c
Showing
7 changed files
with
79 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
|
||
#code { | ||
border: solid black; | ||
height: 100%; | ||
} | ||
|
||
.inner-container:not(.inner-container:first-child) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { ADDITION_MODE, CONST_MODE, DIVISION_MODE, MULTIPLICATION_MODE, SUBTRACTION_MODE } from "./texts/texts.js" | ||
|
||
export const defaultText = (select) => { | ||
const instruction = select.value | ||
switch (instruction) { | ||
case ADDITION_MODE: | ||
return `(module | ||
(func (export "addNumbers") (param i32 i32) (result i32) | ||
local.get 0 | ||
local.get 1 | ||
i32.add) | ||
) | ||
` | ||
case SUBTRACTION_MODE: | ||
return `(module | ||
(func (export "subtractNumbers") (param i32 i32) (result i32) | ||
local.get 0 | ||
local.get 1 | ||
i32.sub) | ||
) | ||
` | ||
case MULTIPLICATION_MODE: | ||
return `(module | ||
(func (export "multiplyNumbers") (param i32 i32) (result i32) | ||
local.get 0 | ||
local.get 1 | ||
i32.mul) | ||
) | ||
` | ||
case DIVISION_MODE: | ||
return `(module | ||
(func (export "divideNumbers") (param i32 i32) (result i32) | ||
local.get 0 | ||
local.get 1 | ||
i32.div) | ||
) | ||
` | ||
case CONST_MODE: | ||
return `(module | ||
(func (export "operationWithInternalVariable") (param i32 i32) (result i32) | ||
local.get 0 | ||
i32.const 10 | ||
i32.add) | ||
) | ||
` | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const CONST_MODE = 'const'; | ||
export const ADDITION_MODE = 'addition'; | ||
export const SUBTRACTION_MODE = 'subtraction'; | ||
export const MULTIPLICATION_MODE = 'multiplication'; | ||
export const DIVISION_MODE = 'division'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters