diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2008486d..961c88c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,4 +75,4 @@ jobs: - name: Run Tests run: | make - ./build/b -run -t 6502 ./examples/10_hello_world.b ./std/6502.b + ./build/b -run -t 6502 ./examples/hello_world.b ./std/6502.b diff --git a/README.md b/README.md index 84026727..d046adb3 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Compiler for the B Programming Language implemented in [Crust](https://github.co ```console $ make -$ ./build/b -run ./examples/10_hello_world.b +$ ./build/b -run ./examples/hello_world.b ``` ### Uxn @@ -32,7 +32,7 @@ $ ./build/b -run ./examples/10_hello_world.b The compiler supports [Uxn](https://100r.co/site/uxn.html) target. Make sure you have `uxnemu` in your `$PATH` if you want to use `-run` flag. ```console -$ ./build/b -t uxn -run ./examples/10_hello_world.b ./std/uxn.b +$ ./build/b -t uxn -run ./examples/hello_world.b ./std/uxn.b ``` Also check out more examples at [./examples/](./examples/). diff --git a/examples/.gitignore b/examples/.gitignore index 1317659a..ebdb4716 100644 --- a/examples/.gitignore +++ b/examples/.gitignore @@ -2,3 +2,4 @@ !*/ !**/*.b !.gitignore +!**/README.md \ No newline at end of file diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 00000000..76cc7ad2 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,15 @@ +# Examples + +This folder contains examples that are meant to be read by the users of the language to learn and explore the capabilities of the language. + +It is recommended to study them in the order of their complexity: from simplest to the most complex. Generally, the size of the file roughly corresponds to its complexity so we recommend to sort the examples by their size and follow that order. + +In a Linux console this could be achived by the running command: + +``` +$ ls -lS +``` + +Where the `-S` flag of the [ls](https://man7.org/linux/man-pages/man1/ls.1.html) utility sorts the files by size, largest first. + +In other operating systems and applications please use similar functionality. diff --git a/examples/80_brainfck.b b/examples/brainfck.b similarity index 100% rename from examples/80_brainfck.b rename to examples/brainfck.b diff --git a/examples/55_da.b b/examples/da.b similarity index 100% rename from examples/55_da.b rename to examples/da.b diff --git a/examples/45_duffs_device.b b/examples/duffs_device.b similarity index 100% rename from examples/45_duffs_device.b rename to examples/duffs_device.b diff --git a/examples/30_echo.b b/examples/echo.b similarity index 100% rename from examples/30_echo.b rename to examples/echo.b diff --git a/examples/40_fib.b b/examples/fib.b similarity index 100% rename from examples/40_fib.b rename to examples/fib.b diff --git a/examples/60_game_of_life.b b/examples/game_of_life.b similarity index 100% rename from examples/60_game_of_life.b rename to examples/game_of_life.b diff --git a/examples/10_hello_world.b b/examples/hello_world.b similarity index 100% rename from examples/10_hello_world.b rename to examples/hello_world.b diff --git a/examples/11_name.b b/examples/name.b similarity index 100% rename from examples/11_name.b rename to examples/name.b diff --git a/examples/70_raylib.b b/examples/raylib.b similarity index 100% rename from examples/70_raylib.b rename to examples/raylib.b diff --git a/examples/50_rule110.b b/examples/rule110.b similarity index 100% rename from examples/50_rule110.b rename to examples/rule110.b diff --git a/examples/20_seq.b b/examples/seq.b similarity index 100% rename from examples/20_seq.b rename to examples/seq.b diff --git a/examples/90_snake.b b/examples/snake.b similarity index 100% rename from examples/90_snake.b rename to examples/snake.b diff --git a/examples/uxn/README.md b/examples/uxn/README.md new file mode 100644 index 00000000..a7238dc3 --- /dev/null +++ b/examples/uxn/README.md @@ -0,0 +1,3 @@ +# Uxn Examples + +Here we keep examples for the [Uxn](https://100r.co/site/uxn.html). They are weird enough to deserve a dedicated folder. diff --git a/examples/uxn/03_callable_globals.b b/examples/uxn/callable_globals.b similarity index 100% rename from examples/uxn/03_callable_globals.b rename to examples/uxn/callable_globals.b diff --git a/examples/uxn/01_hello.b b/examples/uxn/hello.b similarity index 100% rename from examples/uxn/01_hello.b rename to examples/uxn/hello.b diff --git a/examples/uxn/02_screen.b b/examples/uxn/screen.b similarity index 100% rename from examples/uxn/02_screen.b rename to examples/uxn/screen.b