Skip to content

Instantly share code, notes, and snippets.

@davidkellis
Last active January 1, 2019 21:16
Show Gist options
  • Save davidkellis/ae0ecb73205e465a7c7040476a90fd51 to your computer and use it in GitHub Desktop.
Save davidkellis/ae0ecb73205e465a7c7040476a90fd51 to your computer and use it in GitHub Desktop.
david:~/Dropbox/projects/able/compiler $ crystal src/cli.cr -- -f ../examples/helloworld.able
parse tree:
(apply File ; id=5414918336 rule_name="File" label=""
(choice ; id=5414918416 label=""
(seq ; id=5414918496 label=""
(apply PackageDecl ; id=5414919936 rule_name="PackageDecl" label=""
(choice ; id=5414920016 label=""
(seq ; id=5414920096 label=""
"package"[id=5452605472 label=""]
(apply package_ident ; id=5414904128 rule_name="package_ident" label=""
(choice ; id=5414904208 label=""
(seq ; id=5414904288 label=""
(apply letter ; id=5452604272 rule_name="letter" label=""
(choice ; id=5452604352 label=""
(seq ; id=5452604432 label=""
"h"MA[id=5452604512 label=""])))
(repeat ; id=5414904368 label=""
(choice ; id=5452603792 label=""
(seq ; id=5452603872 label=""
(apply letter ; id=5452603952 rule_name="letter" label=""
(choice ; id=5452604032 label=""
(seq ; id=5452604112 label=""
"e"MA[id=5452604192 label=""])))))
(choice ; id=5414907808 label=""
(seq ; id=5452603392 label=""
(apply letter ; id=5452603472 rule_name="letter" label=""
(choice ; id=5452603552 label=""
(seq ; id=5452603632 label=""
"l"MA[id=5452603712 label=""])))))
(choice ; id=5414907328 label=""
(seq ; id=5414907408 label=""
(apply letter ; id=5414907488 rule_name="letter" label=""
(choice ; id=5414907568 label=""
(seq ; id=5414907648 label=""
"l"MA[id=5414907728 label=""])))))
(choice ; id=5414906848 label=""
(seq ; id=5414906928 label=""
(apply letter ; id=5414907008 rule_name="letter" label=""
(choice ; id=5414907088 label=""
(seq ; id=5414907168 label=""
"o"MA[id=5414907248 label=""])))))
(choice ; id=5414906368 label=""
(seq ; id=5414906448 label=""
(apply letter ; id=5414906528 rule_name="letter" label=""
(choice ; id=5414906608 label=""
(seq ; id=5414906688 label=""
"w"MA[id=5414906768 label=""])))))
(choice ; id=5414905888 label=""
(seq ; id=5414905968 label=""
(apply letter ; id=5414906048 rule_name="letter" label=""
(choice ; id=5414906128 label=""
(seq ; id=5414906208 label=""
"o"MA[id=5414906288 label=""])))))
(choice ; id=5414905408 label=""
(seq ; id=5414905488 label=""
(apply letter ; id=5414905568 rule_name="letter" label=""
(choice ; id=5414905648 label=""
(seq ; id=5414905728 label=""
"r"MA[id=5414905808 label=""])))))
(choice ; id=5414904928 label=""
(seq ; id=5414905008 label=""
(apply letter ; id=5414905088 rule_name="letter" label=""
(choice ; id=5414905168 label=""
(seq ; id=5414905248 label=""
"l"MA[id=5414905328 label=""])))))
(choice ; id=5414904448 label=""
(seq ; id=5414904528 label=""
(apply letter ; id=5414904608 rule_name="letter" label=""
(choice ; id=5414904688 label=""
(seq ; id=5414904768 label=""
"d"MA[id=5414904848 label=""])))))))))))))))
ast:
(file
(package_decl helloworld))
golang:
// package declaration
package helloworld
// top level declarations
// go here...
david:~/Dropbox/projects/able/compiler $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment