| 1 | Tea Language
|
| 2 | ============
|
| 3 |
|
| 4 | This is an experiment! Background:
|
| 5 |
|
| 6 | - <http://www.oilshell.org/blog/2020/10/big-changes.html#appendix-the-tea-language>
|
| 7 | - <https://old.reddit.com/r/ProgrammingLanguages/comments/jb5i5m/help_i_keep_stealing_features_from_elixir_because/g8urxou/>
|
| 8 | - <https://lobste.rs/s/4hx42h/assorted_thoughts_on_zig_rust#c_mqpg6e>
|
| 9 | - <https://news.ycombinator.com/item?id=24845983>: mycpp origins, related to
|
| 10 | mycpp and ShedSkin
|
| 11 | - There's no good language for writing languages:
|
| 12 | <https://lobste.rs/s/vmkv3r/first_thoughts_on_rust_vs_ocaml#c_v5ch1q>
|
| 13 |
|
| 14 | tl;dr Tea is a cleanup of Oil's metalanguages, which can be called "statically
|
| 15 | typed Python with sum types". (Zephyr ASDL is pretty clean, but mycpp is
|
| 16 | messy, and needs cleanup.)
|
| 17 |
|
| 18 | - Tea Grammar: <https://github.com/oilshell/oil/blob/master/oil_lang/grammar.pgen2#L363>
|
| 19 | - Tea ASDL Schema: <https://github.com/oilshell/oil/blob/master/frontend/syntax.asdl#L324>
|
| 20 | - Python-like "transformer" from CST to AST:
|
| 21 | <https://github.com/oilshell/oil/blob/master/oil_lang/expr_to_ast.py>. This
|
| 22 | code is repetitive, but it's how CPython did it for 25+ years.
|
| 23 |
|
| 24 | ## Metaphors
|
| 25 |
|
| 26 | - "Oil + Tea" is like "Shell + C". :)
|
| 27 | - Oil could be the metaprogramming language for Tea. "So Oil + Tea" is like
|
| 28 | the "C preprocessor + C".
|
| 29 |
|
| 30 | ## Demo
|
| 31 |
|
| 32 | $ bin/tea -n -c 'var x = 42'
|
| 33 |
|
| 34 | $ bin/oil -O parse_tea -n -c 'var x = 42'
|
| 35 |
|
| 36 | # Similar to both of the above
|
| 37 | $ tea/run.sh parse-one tea/testdata/hello.tea
|
| 38 |
|
| 39 | Note that Tea stands alone as a language, but it can also be intermingled with
|
| 40 | Oil, which I think will be useful for metaprogramming.
|
| 41 |
|
| 42 | ## Testing
|
| 43 |
|
| 44 | This is currently run in the continuous build
|
| 45 | (<http://travis-ci.oilshell.org/jobs/>).
|
| 46 |
|
| 47 | tea/run.sh soil-run
|
| 48 |
|
| 49 |
|