|
4 | 4 |
|
5 | 5 | +++ |
6 | 6 |
|
7 | | -{{< blocks/cover title="The Blech language" image_anchor="top" height="full" color="primary" >}} |
| 7 | +{{< blocks/cover title="The Blech language" image_anchor="top" height="auto" color="primary" >}} |
8 | 8 | <div class="mx-auto"> |
9 | 9 | <a class="btn btn-lg btn-primary mr-3 mb-4" href="{{< relref "/docs" >}}"> |
10 | 10 | Documentation <i class="fas fa-arrow-alt-circle-right ml-2"></i> |
|
22 | 22 |
|
23 | 23 |
|
24 | 24 |
|
| 25 | +{{< blocks/section color="dark">}} |
| 26 | + |
| 27 | +{{< blocks/feature-code title="Look and Feel">}} |
| 28 | +<div style="white-space: pre; font-size: smaller; font-family: SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;" class=""><br class=""><div class=""><span style="color: rgb(63, 151, 223);" class="">struct</span> Display</div><div class=""> <span style="color: rgb(63, 151, 223);" class="">var</span> hundredth: <span style="color: rgb(63, 151, 223);" class="">int32</span> </div><div class=""> <span style="color: rgb(63, 151, 223);" class="">var</span> seconds: <span style="color: rgb(63, 151, 223);" class="">int32</span></div><div class=""> <span style="color: rgb(63, 151, 223);" class="">var</span> minutes: <span style="color: rgb(63, 151, 223);" class="">int32</span></div><div class=""><span style="color: rgb(63, 151, 223);" class="">end</span></div><br class=""><div class=""><span style="color: rgb(162, 86, 55);" class="">@[CFunction(binding = "showConsole", header = "runtimeLAPFAST.h")]</span></div><div class=""><span style="color: rgb(63, 151, 223);" class="">extern</span> <span style="color: rgb(63, 151, 223);" class="">function</span> show (this: Display)</div><br class=""><div class=""><span style="color: rgb(63, 151, 223);" class="">function</span> writeTicksToDisplay (ticks: <span style="color: rgb(63, 151, 223);" class="">int32</span>) (display: Display)</div><div class=""> <span style="color: rgb(63, 151, 223);" class="">let</span> seconds = ticks / 100</div><div class=""> display.minutes = seconds / 60</div><div class=""> display.seconds = seconds - 60 * display.minutes</div><div class=""> display.hundredth = ticks - 100 * seconds</div><div class=""><span style="color: rgb(63, 151, 223);" class="">end</span></div><br class=""><div class=""><span style="color: rgb(63, 151, 223);" class="">activity</span> Measurement (isPressedResetLap: <span style="color: rgb(63, 151, 223);" class="">bool</span>) </div><div class=""> (totalTime: <span style="color: rgb(63, 151, 223);" class="">int32</span>, lastLap: <span style="color: rgb(63, 151, 223);" class="">int32</span>, display: Display)</div><div class=""><span style="color: rgb(157, 78, 150);" class=""> cobegin</span><span style="color: rgb(146, 205, 120);" class=""> // run</div><div class=""> <span style="color: rgb(157, 78, 150);" class="">repeat</span></div><div class=""> <span style="color: rgb(157, 78, 150);" class="">await</span> <span style="color: rgb(63, 151, 223);" class="">true</span></div><div class=""> totalTime = totalTime + 1</div><div class=""> <span style="color: rgb(157, 78, 150);" class="">end</span></div><div class=""> <span style="color: rgb(157, 78, 150);" class="">with</span><span style="color: rgb(146, 205, 120);" class=""> // lap</div><div class=""> <span style="color: rgb(157, 78, 150);" class="">repeat</span></div><div class=""> <span style="color: rgb(146, 205, 120);" class="">// show total time every tick</span></div><div class=""> <span style="color: rgb(157, 78, 150);" class="">repeat</span></div><div class=""> writeTicksToDisplay(totalTime)(display)</div><div class=""> <span style="color: rgb(157, 78, 150);" class="">await</span> <span style="color: rgb(63, 151, 223);" class="">true</span></div><div class=""> <span style="color: rgb(157, 78, 150);" class="">until</span> isPressedResetLap <span style="color: rgb(157, 78, 150);" class="">end</span></div><br class=""><div class=""> <span style="color: rgb(146, 205, 120);" class="">// calculate lap and update display once</span></div><div class=""> <span style="color: rgb(63, 151, 223);" class="">let</span> lapTime = totalTime - lastLap</div><div class=""> lastLap = totalTime</div><div class=""> writeTicksToDisplay(lapTime)(display) </div><div class=""> <span style="color: rgb(157, 78, 150);" class="">await</span> isPressedResetLap</div><div class=""> <span style="color: rgb(146, 205, 120);" class="">// back to total time</span></div><div class=""> <span style="color: rgb(157, 78, 150);" class="">end</span></div><div class=""> <span style="color: rgb(157, 78, 150);" class="">end</span></div><div class=""><span style="color: rgb(63, 151, 223);" class="">end</span></div></div> |
| 29 | +{{< /blocks/feature-code >}} |
| 30 | + |
| 31 | + |
| 32 | +{{< blocks/feature-code color="dark" url="/lecture-blech.pdf">}} |
| 33 | +<div style="white-space: pre; font-size: smaller; font-family: SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;" class=""><div class=""><span style="color: rgb(63, 151, 223);" class="">activity</span> StopWatchController (isPressedStartStop: <span style="color: rgb(63, 151, 223);" class="">bool</span>, <br class=""> isPressedResetLap: <span style="color: rgb(63, 151, 223);" class="">bool</span>) </div><div class=""> (display: Display)</div><div class=""> <span style="color: rgb(63, 151, 223);" class="">var</span> totalTime: <span style="color: rgb(63, 151, 223);" class="">int32</span> </div><div class=""> <span style="color: rgb(63, 151, 223);" class="">var</span> lastLap: <span style="color: rgb(63, 151, 223);" class="">int32</span></div><div class=""> <span style="color: rgb(157, 78, 150);" class="">repeat</span></div><div class=""> <span style="color: rgb(146, 205, 120);" class="">// init</span></div><div class=""> totalTime = 0</div><div class=""> lastLap = 0</div><div class=""> writeTicksToDisplay(totalTime)(display)</div><div class=""> <span style="color: rgb(157, 78, 150);" class="">await</span> isPressedStartStop <span style="color: rgb(146, 205, 120);" class="">// transition init -> run</span></div><div class=""> <span style="color: rgb(157, 78, 150);" class="">repeat</span></div><div class=""> <span style="color: rgb(157, 78, 150);" class="">when</span> isPressedStartStop <span style="color: rgb(157, 78, 150);" class="">abort</span></div><div class=""> <span style="color: rgb(157, 78, 150);" class="">run</span> Measurement(isPressedResetLap)<br class=""> (totalTime, lastLap, display)</div><div class=""> <span style="color: rgb(157, 78, 150);" class="">end</span></div><div class=""> <span style="color: rgb(146, 205, 120);" class="">// stop, show total time and wait</span></div><div class=""> writeTicksToDisplay(totalTime)(display)</div><div class=""> <span style="color: rgb(157, 78, 150);" class="">await</span> isPressedStartStop <span style="color: rgb(63, 151, 223);" class="">or</span> isPressedResetLap</div><div class=""> <span style="color: rgb(157, 78, 150);" class="">until</span> isPressedResetLap <span style="color: rgb(157, 78, 150);" class="">end</span> <span style="color: rgb(146, 205, 120);" class="">// repeat if StartStop was pressed</span></div><div class=""> <span style="color: rgb(146, 205, 120);" class="">// back to init if ResetLap was pressed</span></div><div class=""> <span style="color: rgb(157, 78, 150);" class="">end</span></div><div class=""><span style="color: rgb(63, 151, 223);" class="">end</span></div><br class=""><div class=""><span style="color: rgb(162, 86, 55);" class="">@[EntryPoint]</span></div><div class=""><span style="color: rgb(63, 151, 223);" class="">activity</span> Main (isPressedStartStop: <span style="color: rgb(63, 151, 223);" class="">bool</span>, isPressedReset: <span style="color: rgb(63, 151, 223);" class="">bool</span>)</div><div class=""> <span style="color: rgb(63, 151, 223);" class="">var</span> display: Display</div><div class=""> <span style="color: rgb(157, 78, 150);" class="">cobegin</span></div><div class=""> <span style="color: rgb(157, 78, 150);" class="">run</span> StopWatchController(isPressedStartStop, isPressedReset)<br class=""> (display)</div><div class=""> <span style="color: rgb(157, 78, 150);" class="">with</span> </div><div class=""> <span style="color: rgb(146, 205, 120);" class="">// render display in every tick</span></div><div class=""> <span style="color: rgb(157, 78, 150);" class="">repeat</span></div><div class=""> show(display)</div><div class=""> <span style="color: rgb(157, 78, 150);" class="">await</span> <span style="color: rgb(63, 151, 223);" class="">true</span></div><div class=""> <span style="color: rgb(157, 78, 150);" class="">end</span></div><div class=""> <span style="color: rgb(157, 78, 150);" class="">end</span></div><div class=""><span style="color: rgb(63, 151, 223);" class="">end</span></div><br class=""></div> |
| 34 | +{{< /blocks/feature-code >}} |
| 35 | + |
| 36 | +{{< /blocks/section >}} |
| 37 | + |
25 | 38 |
|
26 | 39 | {{% blocks/lead color="primary" %}} |
27 | 40 | Blech is a *synchronous* programming language for embedded, reactive, realtime-critical software. |
28 | 41 |
|
29 | 42 | It allows writing reactive subprograms and combining them both sequentially and concurrently. |
30 | 43 | Blech compiles to *clean* C, which may be integrated into existing projects or simulation frameworks. |
31 | 44 |
|
32 | | -The German word _Blech_ roughly translates to _bare metal_. |
33 | | -Blech programs can run directly on _the Blech_ on pretty much any embedded device. |
| 45 | +Blech started at [<span style="color: #63BCE5">Bosch Research</span>](https://github.com/boschresearch/blech) and [<span style="color: #63BCE5">now evolves as a community-driven open-source project</span>](/blog/2021/12/20/the-blech-abides/). |
34 | 46 |
|
35 | | -Read our introductory blog post to learn more on [the purpose of Blech](/blog/2020/05/27/the-purpose-of-blech/). |
| 47 | +The language is called _Blech_ - which translates to sheet metal - since _Metal_ was already taken. It expresses that Blech programs can run directly on _the Blech_ on pretty much any embedded device. |
| 48 | + |
| 49 | +Read our introductory blog post to learn more on [<span style="color: #63BCE5">the purpose of Blech</span>](/blog/2020/05/27/the-purpose-of-blech/). |
36 | 50 |
|
37 | 51 | {{% /blocks/lead %}} |
38 | 52 |
|
39 | 53 |
|
40 | | -{{< blocks/section color="dark" >}} |
| 54 | +{{< blocks/section color="secondary" >}} |
41 | 55 |
|
42 | 56 |
|
43 | 57 | {{% blocks/feature icon="fab fa-github" title="Contributions welcome!" url="/docs/contributing/" %}} |
44 | | -We do a [Pull Request](https://github.com/boschresearch/blech/pulls) contributions workflow on **GitHub**. New contributors are always welcome! |
| 58 | +We do a [Pull Request](https://github.com/blech-lang/blech/pulls) contributions workflow on **GitHub**. New contributors are always welcome! |
45 | 59 | {{% /blocks/feature %}} |
46 | 60 |
|
47 | | -{{% blocks/feature icon="fab fa-slack" title="Discuss with the Blech developers!" url="https://blech-lang.slack.com/" %}} |
| 61 | +{{% blocks/feature icon="fab fa-slack" title="Discuss with the Blech developers!" url="http://slack.blech-lang.org" %}} |
48 | 62 | Exchange ideas on the development and evolution of Blech; its compiler, tools and documentation. |
49 | 63 | {{% /blocks/feature %}} |
50 | 64 |
|
|
55 | 69 | {{< /blocks/section >}} |
56 | 70 |
|
57 | 71 |
|
| 72 | + |
0 commit comments