Instantly share code, notes, and snippets.

# Benjamin Gray Aerijo

• Australia
Last active January 16, 2021 08:43
LaTeX commands for Hoare logic
View example.tex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 \documentclass[a4paper]{article} \input{./hoare.tex} \begin{document} \begin{hoare} \heq[a]{m * (a-b) > 0}{n := a-b}{m * n > 0}{\A} \heq[b]{1 * (a-b) > 0}{m := 1}{m * (a-b) > 0}{\A} \heq[c]{a > b}{m := 1}{m * (a-b) > 0}{\PrE(b)} \heq[d]{a > b}{m := 1; n := a-b}{m * n > 0}{\Seq(c, a)} \end{hoare}
Last active March 25, 2023 20:41
Guide to writing your first Tree-sitter grammar
View tree_sitter_guide.md

# Guide to your first Tree-sitter grammar

NOTE: The Tree-sitter API and documentation has changed and improved since this guide was created. I can't guarantee this is up to date.

Tree-sitter is the new way Atom is providing language recognition features, such as syntax highlighting, code folding, autocomplete, and more. In contrast to TextMate grammars, which work by regex matching, Tree-sitter will generate an entire syntax tree. But more on that can be found in it's own docs.

Here, we look at making one from scratch.

Last active January 10, 2023 13:25
Guide to writing an Atom language grammar
View making_language_grammar.md

# A guide to writing a language grammar (TextMate) in Atom

## Tree sitter

• Atom is transitioning to an entirely new way of defining grammars using tree-sitter. This will be enabled by default quite soon now. It is theoretically faster and more powerful than regex based grammars (the one described in this guide), but requires a steeper learning curve. My understanding is that regex based grammars will still be supported however (at least until version 2), so this guide can still be useful. To enable it yourself, go to Settings -> Core and check Use Tree Sitter Parsers

Links for tree-sitter help:

Last active February 5, 2023 15:36
Setting up Atom for LaTeX
View latex_in_atom.md

Disclaimer: I wrote the packages language-latex2e, autocomplete-latex, latex-wordcount, and hyperclick-latex. I still try to provide a list of all useful packages though, so let me know if I have missed one.

This is a general guide for how to get started with LaTeX in Atom.

NOTE: This guide assumes you already have LaTeX installed on your computer. If you do not, I recommend TeX Live.