Skip to content

Instantly share code, notes, and snippets.

View lambdina's full-sized avatar

Adina lambdina

View GitHub Profile
@p4bl0-
p4bl0- / 00_readme.md
Last active October 12, 2023 09:09
A complete compiler for a simple language (in less than 150 LoC)

This project is a tiny compiler for a very simple language consisting of boolean expression.

The language has two constants: 1 for true and 0 for false, and 4 logic gates: ! (not), & (and), | (or), and ^ (xor).

It can also use parentheses to manage priorities.

Here is its grammar in BNF format:

expr ::= "0" | "1"

@darui00kara
darui00kara / Omake.elm
Last active April 10, 2022 13:56
Elm json encode example
-- おまけ用のメモ
> body = Http.jsonBody (UserEncoder.user User.new)
StringBody "application/json" "{\"id\":0,\"name\":\"\",\"email\":\"\"}"
: Http.Body
> import Model.UserDecoder as UserDecoder
> Http.post "http://localhost:4000/exmamples" body UserDecoder.user
Request { method = "POST", headers = [], url = "http://localhost:4000/exmamples", body = StringBody "application/json" "{\"id\":0,\"name\":\"\",\"email\":\"\"}", expect = { responseType = "text", responseToResult = <function> }, timeout = Nothing, withCredentials = False }
: Http.Request Model.User.Schema