From 6268b356aac9be8e09badb044a159bfd1381e891 Mon Sep 17 00:00:00 2001 From: Diego Lopez <2109094@upy.edu.mx> Date: Wed, 4 Mar 2026 18:30:32 -0600 Subject: [PATCH] Calling convention - Output explanation --- README.md | 4 +- blog-post-1.md | 52 ++++++++++++------------ calling-convention/Output-explanation.md | 24 +++++++++++ 3 files changed, 52 insertions(+), 28 deletions(-) create mode 100644 calling-convention/Output-explanation.md diff --git a/README.md b/README.md index ce38bea..1b55192 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -# lopez-repo - +# lopez-repo + Spider Internship \ No newline at end of file diff --git a/blog-post-1.md b/blog-post-1.md index 1c4bb5a..78448e0 100644 --- a/blog-post-1.md +++ b/blog-post-1.md @@ -1,27 +1,27 @@ -# Spider Programming Language - -Spider is a lightweight scripting language designed to be simple to build, -easy to embed, and straightforward to learn. - -## Why Spider? - -Most modern scripting languages have become increasingly complex over time. -Spider was created to solve three main problems: - -- **Hard to embed:** Languages like Lua have verbose APIs and JavaScript - interpreters are massive projects that take hours to compile. -- **Poor interoperability:** Python and Lua make it complicated to communicate - between the script and the host application. -- **Outdated syntax:** Spider aims for a clean, modern syntax without - requiring keywords like `end` or relying on indentation for structure. - -## How it works - -Spider compiles down to bytecode that runs on the Spider Virtual Machine (VM). -The VM is written in C and can be compiled with a single Makefile, making it -easy to port to any platform, including microcontrollers like the ATmega328p. - -## Current Status - -Currently in early development. The VM architecture, instruction set, +# Spider Programming Language + +Spider is a lightweight scripting language designed to be simple to build, +easy to embed, and straightforward to learn. + +## Why Spider? + +Most modern scripting languages have become increasingly complex over time. +Spider was created to solve three main problems: + +- **Hard to embed:** Languages like Lua have verbose APIs and JavaScript + interpreters are massive projects that take hours to compile. +- **Poor interoperability:** Python and Lua make it complicated to communicate + between the script and the host application. +- **Outdated syntax:** Spider aims for a clean, modern syntax without + requiring keywords like `end` or relying on indentation for structure. + +## How it works + +Spider compiles down to bytecode that runs on the Spider Virtual Machine (VM). +The VM is written in C and can be compiled with a single Makefile, making it +easy to port to any platform, including microcontrollers like the ATmega328p. + +## Current Status + +Currently in early development. The VM architecture, instruction set, register table, and calling convention have been defined and are being tested. \ No newline at end of file diff --git a/calling-convention/Output-explanation.md b/calling-convention/Output-explanation.md new file mode 100644 index 0000000..802c004 --- /dev/null +++ b/calling-convention/Output-explanation.md @@ -0,0 +1,24 @@ +# Calling Convention — Output Explanation + +This document explains the output of the calling convention algorithm +implemented in `calling-convention.ipynb`, tested across 3 scenarios. + +--- + +## TEST 1: A single 1-byte argument + +**Function signature:** `result = func(x)` where `x` is 8 bits (1 byte) + +**Output:** +``` +===== TEST 1: a 1 byte argument ===== +=== State after do_function_call === +Registers used: ['RA'] +Stack: [{'type': 'caller_saved', 'reg': 'R0', 'value': 0}, {'type': 'caller_saved', 'reg': 'R1', 'value': 0}, {'type': 'caller_saved', 'reg': 'R2', 'value': 0}, {'type': 'caller_saved', 'reg': 'R3', 'value': 0}] +RS points to: 4 +=== State after undo_function_call === +Clean stack: [] +RS: 0 +Collected result: {'result': {'type': 'result', 'value': 42}} + +