aboutsummaryrefslogtreecommitdiff
path: root/doc/docs/index.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/docs/index.md')
-rw-r--r--doc/docs/index.md45
1 files changed, 45 insertions, 0 deletions
diff --git a/doc/docs/index.md b/doc/docs/index.md
new file mode 100644
index 0000000..c2bebe4
--- /dev/null
+++ b/doc/docs/index.md
@@ -0,0 +1,45 @@
+---
+vim: noexpandtab tabstop=2 shiftwidth=2
+---
+
+# Snug
+
+Snug is a lazy functional programming language. It is designed to be tiny in
+memory footprint of both generated code and run time memory use, so that it can
+run on embedded systems.
+
+The current goal is to be able to run a Snug compiler written in Snug on a
+[PIC32MZ2048EFG064][]. This microcontroller has 2MB flash memory, 512KB SRAM,
+and a MIPS32 instruction set (with microMIPS code compression).
+
+The end goal is as follows:
+
+1. The microcontroller has access to a flash drive or SD card with a basic file
+ system.
+2. The kernel contains a basic terminal application and can run programs from
+ the external memory. To this end it dynamically loads these programs into
+ RAM and executes from RAM.
+3. There is an application to edit text files.
+4. The Snug compiler is just one of these programs, and was compiled from Snug
+ itself. It outputs human-readable assembly code.
+5. A basic assembler (presumably written in C) can turn this output into object
+ code.
+6. A linker (presumably written in C) can link several object code files
+ together into an executable program.
+7. Combining steps 3-6, possibly using a `make`-like program, enables the user
+ to edit, compile, and run new Snug programs entirely on the embedded system.
+
+Before we can accomplish this some intermediate steps are required:
+
+1. At first the compiler is written in [Clean][], and we use an assembler and
+ linker on a PC. This way an executable compiler can be built entirely on a
+ PC.
+2. The next step is to test how much RAM the compiler requires. It should be
+ able to compile reasonably large programs with only 512KB of RAM (and
+ actually less, because part of the RAM must be reserved for the kernel and
+ to hold the program itself).
+3. After this a basic assembler and linker can be written. If these are written
+ in C it is easily possible to test them on a PC.
+
+[Clean]: https://clean-lang.org
+[PIC32MZ2048EFG064]: https://www.microchip.com/en-us/product/PIC32MZ2048EFG064