Last active
May 24, 2022 00:55
-
-
Save VideoCarp/3dacf5d402c1e5197d4b9adf25088865 to your computer and use it in GitHub Desktop.
Bits of code embedded onto my site.
This file contains hidden or 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
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 |
This file contains hidden or 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
# 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