Skip to content

Instantly share code, notes, and snippets.

@VideoCarp
Last active May 24, 2022 00:55
Show Gist options
  • Save VideoCarp/3dacf5d402c1e5197d4b9adf25088865 to your computer and use it in GitHub Desktop.
Save VideoCarp/3dacf5d402c1e5197d4b9adf25088865 to your computer and use it in GitHub Desktop.
Bits of code embedded onto my site.
defmodule Lexer do
def lex(current \\ 0, tokenstream \\ [], len, input_str) do
char = String.at(input_str, current)
unless current >= len do
cond do
...
end
else
tokenstream
end
end
# Turn this:
# out("Hello World!")
# into this
[
{"out", :identifier},
{"(", :oparen},
{"Hello World!", :string},
{")", :cparen}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment