├── .gitignore ├── Package.swift ├── README.md ├── Sources ├── Swag │ └── main.swift └── SwagCore │ ├── Binary │ ├── Dumper.swift │ ├── Exporter.swift │ ├── Instruction.swift │ ├── Module.swift │ ├── Opcode.swift │ ├── ParseError.swift │ ├── Reader.swift │ └── Types.swift │ ├── Interpreter │ ├── ControlFrame.swift │ ├── Function.swift │ ├── Global.swift │ ├── Instructions │ │ ├── ControlInstructions.swift │ │ ├── Instructions.swift │ │ ├── MemoryInstructions.swift │ │ ├── NumericInstructions.swift │ │ ├── ParametricInstructions.swift │ │ └── VariableInstructions.swift │ ├── Memory.swift │ ├── Native.swift │ ├── OperandStack.swift │ ├── Snapshot.swift │ ├── Table.swift │ └── VM.swift │ └── Utilities │ └── Extensions.swift ├── Swag.xcodeproj ├── SwagCore_Info.plist ├── SwagTests_Info.plist ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── xcshareddata │ └── xcschemes │ ├── Swag-Package.xcscheme │ └── Swag.xcscheme └── Tests ├── Fixtures ├── 00_Instructions │ ├── NumericInstructions.wasm │ ├── NumericInstructions.wat │ ├── ParametricInstructions.wasm │ └── ParametricInstructions.wat ├── 01_HelloWorld │ ├── HelloWorld.dump │ ├── HelloWorld.html │ ├── HelloWorld.rs │ └── HelloWorld.wasm ├── 02_Fibonacci │ ├── Fibonacci.dump │ ├── Fibonacci.wasm │ └── Fibonacci.wat ├── 03_Factorial │ ├── Factorial.wasm │ ├── Factorial.wat │ ├── Factorial2.wasm │ └── Factorial2.wat ├── 04_Memory │ ├── Memory.wasm │ └── Memory.wat ├── 05_Calc │ ├── Calc.wasm │ └── Calc.wat ├── 06_Trace_Int │ ├── trace1_int.wasm │ ├── trace2_str.wasm │ ├── trace3_array.wasm │ └── trace4.wasm ├── Control_Ins │ ├── br.wasm │ ├── br.wat │ ├── label_names.wasm │ ├── label_names.wat │ ├── nested_labels.wasm │ └── nested_labels.wat └── Malloc │ ├── example1.wasm │ ├── example1.wat │ ├── example2.wasm │ ├── example2.wat │ ├── example3.wasm │ └── example3.wat ├── LinuxMain.swift └── SwagTests ├── SwagCoreTests.swift ├── SwagSnapshotTests.swift ├── SwagTests.swift └── XCTestManifests.swift /.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/.gitignore -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Package.swift -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/README.md -------------------------------------------------------------------------------- /Sources/Swag/main.swift: -------------------------------------------------------------------------------- 1 | import SwagCore 2 | 3 | print("Hello, world!") 4 | -------------------------------------------------------------------------------- /Sources/SwagCore/Binary/Dumper.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Binary/Dumper.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Binary/Exporter.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Binary/Exporter.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Binary/Instruction.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Binary/Instruction.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Binary/Module.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Binary/Module.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Binary/Opcode.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Binary/Opcode.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Binary/ParseError.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Binary/ParseError.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Binary/Reader.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Binary/Reader.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Binary/Types.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Binary/Types.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Interpreter/ControlFrame.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Interpreter/ControlFrame.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Interpreter/Function.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Interpreter/Function.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Interpreter/Global.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Interpreter/Global.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Interpreter/Instructions/ControlInstructions.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Interpreter/Instructions/ControlInstructions.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Interpreter/Instructions/Instructions.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Interpreter/Instructions/Instructions.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Interpreter/Instructions/MemoryInstructions.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Interpreter/Instructions/MemoryInstructions.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Interpreter/Instructions/NumericInstructions.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Interpreter/Instructions/NumericInstructions.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Interpreter/Instructions/ParametricInstructions.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Interpreter/Instructions/ParametricInstructions.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Interpreter/Instructions/VariableInstructions.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Interpreter/Instructions/VariableInstructions.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Interpreter/Memory.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Interpreter/Memory.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Interpreter/Native.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Interpreter/Native.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Interpreter/OperandStack.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Interpreter/OperandStack.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Interpreter/Snapshot.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Interpreter/Snapshot.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Interpreter/Table.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Interpreter/Table.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Interpreter/VM.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Interpreter/VM.swift -------------------------------------------------------------------------------- /Sources/SwagCore/Utilities/Extensions.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Sources/SwagCore/Utilities/Extensions.swift -------------------------------------------------------------------------------- /Swag.xcodeproj/SwagCore_Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Swag.xcodeproj/SwagCore_Info.plist -------------------------------------------------------------------------------- /Swag.xcodeproj/SwagTests_Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Swag.xcodeproj/SwagTests_Info.plist -------------------------------------------------------------------------------- /Swag.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Swag.xcodeproj/project.pbxproj -------------------------------------------------------------------------------- /Swag.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Swag.xcodeproj/project.xcworkspace/contents.xcworkspacedata -------------------------------------------------------------------------------- /Swag.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Swag.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist -------------------------------------------------------------------------------- /Swag.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Swag.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings -------------------------------------------------------------------------------- /Swag.xcodeproj/xcshareddata/xcschemes/Swag-Package.xcscheme: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Swag.xcodeproj/xcshareddata/xcschemes/Swag-Package.xcscheme -------------------------------------------------------------------------------- /Swag.xcodeproj/xcshareddata/xcschemes/Swag.xcscheme: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Swag.xcodeproj/xcshareddata/xcschemes/Swag.xcscheme -------------------------------------------------------------------------------- /Tests/Fixtures/00_Instructions/NumericInstructions.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/00_Instructions/NumericInstructions.wasm -------------------------------------------------------------------------------- /Tests/Fixtures/00_Instructions/NumericInstructions.wat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/00_Instructions/NumericInstructions.wat -------------------------------------------------------------------------------- /Tests/Fixtures/00_Instructions/ParametricInstructions.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/00_Instructions/ParametricInstructions.wasm -------------------------------------------------------------------------------- /Tests/Fixtures/00_Instructions/ParametricInstructions.wat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/00_Instructions/ParametricInstructions.wat -------------------------------------------------------------------------------- /Tests/Fixtures/01_HelloWorld/HelloWorld.dump: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/01_HelloWorld/HelloWorld.dump -------------------------------------------------------------------------------- /Tests/Fixtures/01_HelloWorld/HelloWorld.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/01_HelloWorld/HelloWorld.html -------------------------------------------------------------------------------- /Tests/Fixtures/01_HelloWorld/HelloWorld.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/01_HelloWorld/HelloWorld.rs -------------------------------------------------------------------------------- /Tests/Fixtures/01_HelloWorld/HelloWorld.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/01_HelloWorld/HelloWorld.wasm -------------------------------------------------------------------------------- /Tests/Fixtures/02_Fibonacci/Fibonacci.dump: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/02_Fibonacci/Fibonacci.dump -------------------------------------------------------------------------------- /Tests/Fixtures/02_Fibonacci/Fibonacci.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/02_Fibonacci/Fibonacci.wasm -------------------------------------------------------------------------------- /Tests/Fixtures/02_Fibonacci/Fibonacci.wat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/02_Fibonacci/Fibonacci.wat -------------------------------------------------------------------------------- /Tests/Fixtures/03_Factorial/Factorial.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/03_Factorial/Factorial.wasm -------------------------------------------------------------------------------- /Tests/Fixtures/03_Factorial/Factorial.wat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/03_Factorial/Factorial.wat -------------------------------------------------------------------------------- /Tests/Fixtures/03_Factorial/Factorial2.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/03_Factorial/Factorial2.wasm -------------------------------------------------------------------------------- /Tests/Fixtures/03_Factorial/Factorial2.wat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/03_Factorial/Factorial2.wat -------------------------------------------------------------------------------- /Tests/Fixtures/04_Memory/Memory.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/04_Memory/Memory.wasm -------------------------------------------------------------------------------- /Tests/Fixtures/04_Memory/Memory.wat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/04_Memory/Memory.wat -------------------------------------------------------------------------------- /Tests/Fixtures/05_Calc/Calc.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/05_Calc/Calc.wasm -------------------------------------------------------------------------------- /Tests/Fixtures/05_Calc/Calc.wat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/05_Calc/Calc.wat -------------------------------------------------------------------------------- /Tests/Fixtures/06_Trace_Int/trace1_int.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/06_Trace_Int/trace1_int.wasm -------------------------------------------------------------------------------- /Tests/Fixtures/06_Trace_Int/trace2_str.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/06_Trace_Int/trace2_str.wasm -------------------------------------------------------------------------------- /Tests/Fixtures/06_Trace_Int/trace3_array.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/06_Trace_Int/trace3_array.wasm -------------------------------------------------------------------------------- /Tests/Fixtures/06_Trace_Int/trace4.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/06_Trace_Int/trace4.wasm -------------------------------------------------------------------------------- /Tests/Fixtures/Control_Ins/br.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/Control_Ins/br.wasm -------------------------------------------------------------------------------- /Tests/Fixtures/Control_Ins/br.wat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/Control_Ins/br.wat -------------------------------------------------------------------------------- /Tests/Fixtures/Control_Ins/label_names.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/Control_Ins/label_names.wasm -------------------------------------------------------------------------------- /Tests/Fixtures/Control_Ins/label_names.wat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/Control_Ins/label_names.wat -------------------------------------------------------------------------------- /Tests/Fixtures/Control_Ins/nested_labels.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/Control_Ins/nested_labels.wasm -------------------------------------------------------------------------------- /Tests/Fixtures/Control_Ins/nested_labels.wat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/Control_Ins/nested_labels.wat -------------------------------------------------------------------------------- /Tests/Fixtures/Malloc/example1.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/Malloc/example1.wasm -------------------------------------------------------------------------------- /Tests/Fixtures/Malloc/example1.wat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/Malloc/example1.wat -------------------------------------------------------------------------------- /Tests/Fixtures/Malloc/example2.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/Malloc/example2.wasm -------------------------------------------------------------------------------- /Tests/Fixtures/Malloc/example2.wat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/Malloc/example2.wat -------------------------------------------------------------------------------- /Tests/Fixtures/Malloc/example3.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/Malloc/example3.wasm -------------------------------------------------------------------------------- /Tests/Fixtures/Malloc/example3.wat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/Fixtures/Malloc/example3.wat -------------------------------------------------------------------------------- /Tests/LinuxMain.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/LinuxMain.swift -------------------------------------------------------------------------------- /Tests/SwagTests/SwagCoreTests.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/SwagTests/SwagCoreTests.swift -------------------------------------------------------------------------------- /Tests/SwagTests/SwagSnapshotTests.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/SwagTests/SwagSnapshotTests.swift -------------------------------------------------------------------------------- /Tests/SwagTests/SwagTests.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/SwagTests/SwagTests.swift -------------------------------------------------------------------------------- /Tests/SwagTests/XCTestManifests.swift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ji4n1ng/Swag/HEAD/Tests/SwagTests/XCTestManifests.swift --------------------------------------------------------------------------------