Skip to content

Instantly share code, notes, and snippets.

@filhodanuvem
Last active December 15, 2015 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save filhodanuvem/5189574 to your computer and use it in GitHub Desktop.
Save filhodanuvem/5189574 to your computer and use it in GitHub Desktop.
How a simple parser to python can generate a AST ?
def foo():
name = "cloud"
age = 22
if age > 22 :
print name
age += 1
@jeanpimentel
Copy link

no lexico, se leu \n, vai pro estado qn

leia o proximo, se \s ou \t, conte e armazene até sair de qn

ao sair de qn

se atual > anterior => T_IDENT_START
senao se atual = anterior => null
senao => T_IDENT_END

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment