|
1 | | -# EmojiCode Fraglet Guide |
| 1 | +# Emojicode Fraglet Guide |
2 | 2 |
|
3 | 3 | ## Language Version |
4 | | -EmojiCode (compiled language) |
| 4 | +Emojicode (as installed in this container; run `emojicodec --version` inside the container if you need the exact version). |
5 | 5 |
|
6 | 6 | ## Execution Model |
7 | | -- Compiled via `emojicodec` compiler |
8 | | -- Produces native binary executable |
| 7 | +- **Compiled language** using the `emojicodec` compiler. |
| 8 | +- Your fraglet **replaces the entire contents** between `π BEGIN_FRAGLET` and `π END_FRAGLET` in `hello-world.π`. |
| 9 | +- The resulting file is compiled and run as a normal Emojicode program. |
| 10 | + |
| 11 | +## Key Characteristics |
| 12 | +- **Emoji-based syntax** for all core constructs (entry point, blocks, variables, printing, comments). |
| 13 | +- **Compiled to native code**; errors are reported by `emojicodec` with file/position info. |
| 14 | +- **Block-structured** with explicit start (`π`) and end (`π`) delimiters. |
| 15 | +- **Statement-terminated** with `βοΈ`. |
9 | 16 |
|
10 | 17 | ## Fragment Authoring |
11 | | -Write a complete EmojiCode program. Your fragment replaces the entire source file. |
| 18 | +- **You write a complete Emojicode program.** Your fraglet is not injected into `main` or any other function body. |
| 19 | +- You must include: |
| 20 | + - Program entry: `π` |
| 21 | + - A top-level block: `π` ... `π` |
| 22 | + - Whatever statements you want to run inside that block. |
| 23 | +- The minimal shape looks like: |
| 24 | + |
| 25 | +```emojicode |
| 26 | +π π |
| 27 | + β¦your statementsβ¦ |
| 28 | +π |
| 29 | +``` |
| 30 | + |
| 31 | +## Mental Model |
| 32 | +You write a **full, valid Emojicode program**, starting with `π` and a `π β¦ π` block, and we **compile and run it as-is**. |
| 33 | +Nothing is injected for you and no `main` wrapper is added β if your program wouldnβt compile with `emojicodec` on its own, it wonβt compile as a fraglet. |
12 | 34 |
|
13 | 35 | ## Basic Syntax |
14 | | -- `π` - Main function entry point |
15 | | -- `π` / `π` - Block start / end |
16 | | -- `π` - Print statement |
17 | | -- `π€...π€` - String literal delimiters |
18 | | -- `βοΈ` - Statement terminator |
19 | | -- `π` - Comment marker |
| 36 | +- `π` β Program entry point. |
| 37 | +- `π` / `π` β Block start / end. |
| 38 | +- `π` β Print statement. |
| 39 | +- `π€β¦π€` β String literal delimiters. |
| 40 | +- `βοΈ` β Statement terminator. |
| 41 | +- `π` β Comment / annotation. |
20 | 42 |
|
21 | 43 | ## Variables and Types |
22 | | -- `ππ` - Declare a mutable variable |
23 | | -- `π’` - Integer type |
24 | | -- `π‘` - String type |
25 | | -- Declaration: `ππ x π’ 5` |
26 | | - |
27 | | -## Conditionals |
28 | | -- `βͺοΈ` - If |
29 | | -- `π
` - Else |
30 | | -- `π
βͺοΈ` - Else-if |
31 | | -- `π` / `π` - True / False |
| 44 | +- `ππ` β Declare a mutable variable. |
| 45 | +- Common types: |
| 46 | + - `π’` β Integer. |
| 47 | + - `π‘` β String. |
| 48 | +- Example declaration: |
32 | 49 |
|
33 | | -## Examples |
34 | 50 | ```emojicode |
35 | | -π π |
36 | | - π π€Hello World!π€βοΈ |
37 | | -π |
| 51 | +ππ x π’ 5βοΈ |
38 | 52 | ``` |
39 | 53 |
|
| 54 | +## Examples |
| 55 | + |
| 56 | +### Minimal Hello World |
| 57 | +This is the smallest program you should expect to compile and run as a fraglet in this vein: |
| 58 | + |
40 | 59 | ```emojicode |
41 | 60 | π π |
42 | | - π π€First lineπ€βοΈ |
43 | | - π π€Second lineπ€βοΈ |
| 61 | + π π€Hello from Emojicode fraglet!π€βοΈ |
44 | 62 | π |
45 | 63 | ``` |
46 | 64 |
|
| 65 | +### Variables and printing |
| 66 | +A slightly richer example with a variable and formatted output: |
| 67 | + |
47 | 68 | ```emojicode |
48 | 69 | π π |
49 | | - ππ x π’ 5 |
50 | | - βͺοΈ π π |
51 | | - π π€True!π€βοΈ |
52 | | - π |
53 | | - π
π |
54 | | - π π€False!π€βοΈ |
55 | | - π |
| 70 | + ππ times π’ 3βοΈ |
| 71 | + π π€About to greetβ¦π€βοΈ |
| 72 | + π π€Hello π€βοΈ |
| 73 | + π π€We greeted π€βοΈ |
| 74 | + π π€times: π€βοΈ |
| 75 | + π timesβοΈ |
56 | 76 | π |
57 | 77 | ``` |
58 | 78 |
|
| 79 | +Both examples are complete programs: if you drop them between `π BEGIN_FRAGLET` and `π END_FRAGLET` in `hello-world.π`, they should compile and run under this fraglet vein. |
| 80 | + |
59 | 81 | ## Caveats |
60 | | -- Ensure your editor supports Unicode emoji characters |
61 | | -- String literals must be wrapped in `π€` delimiters |
62 | | -- Statements end with `βοΈ` |
63 | | -- Variable declarations require `ππ` prefix |
| 82 | +- **Full program required**: Fragments that are just statements like `π π€Helloπ€βοΈ` without `π π` β¦ `π` will fail to compile. |
| 83 | +- **Compiler errors are authoritative**: If execution fails, read the `emojicodec` error message and iterate until it compiles β this guide describes the expected structure, but the compiler is the final arbiter. |
| 84 | +- Ensure your editor supports **Unicode emoji** so characters are preserved correctly. |
| 85 | +- **String literals** must be wrapped in `π€` delimiters. |
| 86 | +- **Every statement** (including variable declarations and prints) must end with `βοΈ`. |
| 87 | +- Variable declarations require the `ππ` prefix and an appropriate type emoji. |
0 commit comments