top | item 45428138

(no title)

DSpinellis | 5 months ago

I went through two iterations before adopting the current syntax. Truth is neither me nor Doug McIlroy, the inventor of Unix pipes, who kindly and generously provided feedback during dgsh's development, had something better to propose.

What syntax would you propose?

discuss

order

esafak|5 months ago

Greetings, Diomidis.

I would suggest a familiar notation like "[a, b] -> c" in a dedicated dag block:

  dag text_stats {
    tee -> [ split_words, count_chars ]

    # word-based frequencies
    split_words -> tee_words
    tee_words -> ngram2 -> save_digram
    tee_words -> ngram3 -> save_trigram
    tee_words -> ranked_frequency -> save_words

    # character-based frequencies
    count_chars -> add_percentage
    chars_to_lines -> ranked_frequency -> add_percentage -> save_chars
  }

  run text_stats < input.txt
https://www2.dmst.aueb.gr/dds/sw/dgsh/#text-properties

or

  dag commit_graph {
    git_log -> filter_recent -> sort -n -> [ uniq_committers, sort_by_email ]

    uniq_committers -> [ last_commit, first_commit, committer_positions ]
    [ last_commit, first_commit ] -> cat -> tr '\n' ' ' -> days_between

    [ committer_positions, sort_by_email ] -> join_by_email -> sort -k2n -> [ make_bitmap_header, plot_per_day ]

    [ uniq_committers, days_between ] -> emit_dims -> plot_per_day

    make_bitmap_header -> cat
    plot_per_day -> morphconv -> [ to_png_large, to_png_small ]
  }

  run commit_graph
https://www2.dmst.aueb.gr/dds/sw/dgsh/#committer-plot

The translations above are computer-assisted and may contain mistakes, but you get the idea.

shanemhansen|5 months ago

The closeness of this syntax to graphviz dot is very interesting.

having dgsh output a graphvis file in dry-run mode would be a neat feature.

DSpinellis|5 months ago

Thank you for the suggestion. This would mean that you'd also then create some mapping from each name (like git_log) to its implementation, right?