Skip to content

david-andrew/dewy-lang

Repository files navigation

Dewy logo

The Dewy Programming Language

Dewy is a general purpose programming language with a focus on engineering.

NOTE: Still very work in progress, and the docs (including this README) are frequently out of date!

Current Status

dewy

The main compiler for the language is being reweritten from scratch under src/cleanparse/

udewy

The micro subset, udewy, is largely feature complete and available under udewy/. Currently only supports linux x86_64.

A vscode extension for syntax highlighting is available at https://marketplace.visualstudio.com/items?itemName=RedFoxLabs.udewy

Installation

Dependancies

For now, the only dependency is Python >= 3.12 with an optional dependency on rich for rich printing/errors (pip install rich)

Later (dev) dependencies will probably include QBE

Automatic

python install.py

This should work on most linux distros with most common shells (sh, bash, zsh, fish). This script just attempts to add the lines below from the Manual section to your .profile or equivalent file, or your .rc file (e.g. .bashrc) if available.

If you don't have a .rc file, You will need to logout and log back in for changes to take effect. Otherwise, you can run source ~/.rc to apply changes, or open a new terminal.

Manual

  1. Add the following to your distribution/shell's corresponding .profile or .rc file:

    if [ -d "/home/user/path/to/dewy-lang" ]; then
      PATH="/home/user/path/to/dewy-lang:$PATH"
    fi
    

    Note: Be sure to adjust the path in the command to match the current absolute path of this repo

    Note: If modifying .profile, you must logout, and log back in for changes to take effect. If modifying a .rc file (e.g. .bashrc), then either run source path/to/.rc to apply changes, or open a new terminal

Try it out

Note that the language parser is largely incomplete, and there are very many different syntaxes that will get trapped at breakpoints marking TODO, or cause exceptions for NotImplementedError

If you completed the install steps, you can simply run:

dewy my_script.dewy

otherwise you can run the python script directly

python -m src.frontend ../path/to/my_script.dewy

Examples

Several example programs are available in examples/. Here is a breakdown of which ones work with the current progress:

Filename status
hello.dewy [✓]
hello_func.dewy [✓]
hello_name.dewy [✓]
hello_loop.dewy [✓]
anonymous_func.dewy [✓]
if_else.dewy [✓]
if_else_if.dewy [✓]
dangling_else.dewy [✓]
if_tree.dewy [✓]
loop_in_iter.dewy [✓]
loop_and_iters.dewy [✓]
enumerate_list.dewy [✓]
loop_or_iters.dewy [✓]
nested_loop.dewy [✓]
block_printing.dewy [✓]
row_vs_col.dewy [✗]
tensors.dewy [✗]
arrays.dewy [✗]
objects.dewy [✓]
unpack_array.dewy [✓]
unpack_dict.dewy [✓]
unpack_object.dewy [✗]
declare.dewy [✗]
loop_iter_manual.dewy [✗]
range_iter_test.dewy [✗]
functions.dewy [✓]
partial_functions.dewy [✓]
closure.dewy [✓]
function_signatures.dewy [✓]
opchains.dewy [✓]
ops.dewy [✗]
shebang.dewy [✗]
fizzbuzz-1.dewy [✓]
fizzbuzz0.dewy [✓]
fizzbuzz1.dewy [✗]
random.dewy [✓]
primes.dewy [✓]
primes2.dewy [✗]
mdbook_preprocessor.dewy [✗]
fast_inverse_sqrt.dewy [✗]
rule110.dewy [✗]
dewy_syntax_examples.dewy [✗]
syntax.dewy [✗]
tokenizer.dewy [✗]

Documentation

Currently out of date documentation is available at: https://david-andrew.github.io/dewy-lang/

About

A programming language

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors