summaryrefslogtreecommitdiff
path: root/tiger-compiler/tcsh/python/tests/tc.ipynb
diff options
context:
space:
mode:
authorMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:07:58 +0200
committerMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:07:58 +0200
commit967be9e750221ab2ab783f95df79bb26d290a45e (patch)
tree6802900a5e975f9f68b169f0f503f040056d6952 /tiger-compiler/tcsh/python/tests/tc.ipynb
add: added projectsHEADmain
Diffstat (limited to 'tiger-compiler/tcsh/python/tests/tc.ipynb')
-rw-r--r--tiger-compiler/tcsh/python/tests/tc.ipynb252
1 files changed, 252 insertions, 0 deletions
diff --git a/tiger-compiler/tcsh/python/tests/tc.ipynb b/tiger-compiler/tcsh/python/tests/tc.ipynb
new file mode 100644
index 0000000..58cfa3f
--- /dev/null
+++ b/tiger-compiler/tcsh/python/tests/tc.ipynb
@@ -0,0 +1,252 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "id": "cefa08c9",
+ "metadata": {},
+ "source": [
+ "# Import tc"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "id": "989c2dff",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import tc"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "37e62513",
+ "metadata": {},
+ "source": [
+ "# Tiger Magics"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "id": "38583076",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "%%tiger variable_name [backend]\n",
+ "variable_name is the name of the finale variable\n",
+ "backend is optional and must be in [llvm, hir, lir, mips, ia32]\n"
+ ]
+ }
+ ],
+ "source": [
+ "print(tc.TigerMagics.__doc__)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "id": "0e93343f",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "UsageError: %%tiger is a cell magic, but the cell body is empty.\n"
+ ]
+ }
+ ],
+ "source": [
+ "%%tiger"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "id": "d2d30487",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "UsageError: %%tiger is a cell magic, but the cell body is empty.\n"
+ ]
+ }
+ ],
+ "source": [
+ "%%tiger execution"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "id": "c5ce6c25",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "%%tiger variable_name [backend]\n",
+ "variable_name is the name of the finale variable\n",
+ "backend is optional and must be in [llvm, hir, lir, mips, ia32]\n"
+ ]
+ }
+ ],
+ "source": [
+ "%%tiger\n",
+ "let in end"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "id": "05856612",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "%%tiger execution\n",
+ "let in end"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "326e35de",
+ "metadata": {},
+ "source": [
+ "# tc Variables and Functions"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "id": "97e995a8",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "<Swig Object of type 'std::ostream *' at 0x7fd40876a430>"
+ ]
+ },
+ "execution_count": 7,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "tc.Cout"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "id": "ad4ebd05",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "<Swig Object of type 'std::ostream *' at 0x7fd40876a610>"
+ ]
+ },
+ "execution_count": 8,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "tc.Cerr"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "id": "6790e6ee",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "<enum 'BackendType'>"
+ ]
+ },
+ "execution_count": 9,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "tc.BackendType"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "id": "34ebeb8c",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "<function tc.has(module_name: str) -> bool>"
+ ]
+ },
+ "execution_count": 10,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "tc.has"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "id": "fc67329d",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "True"
+ ]
+ },
+ "execution_count": 11,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "tc.has(\"common\")"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.10.1"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}