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
| FROM ubuntu:focal | |
| # install required package to install LLVM and Rust | |
| RUN apt-get update | |
| RUN apt-get install -y apt-utils | |
| RUN apt-get install -y wget gnupg software-properties-common | |
| RUN apt-get install -y git curl gcc zlib1g-dev openssl build-essential pkg-config libssl-dev zsh libclang-dev | |
| # install LLVM | |
| RUN apt-get install -y llvm-8 llvm-8-* liblld-8* |
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
| define i32 @main(i32, i8**) { | |
| %0 = getelementptr inbounds i8*, i8** %1, i64 1 | |
| %1 = load i8*, i8** %0, align 8, !tbaa !0 | |
| %2 = tail call i32 @puts(i8* %1) | |
| ret i32 0 | |
| } | |
| !0 = !{!1, !1, i64 0} | |
| !1 = !{!"any pointer", !2, i64 0} | |
| !2 = !{!"omnipotent char", !3, i64 0} |
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
| # define global variables | |
| PRECEDENCE = {"+": 10, "*": 20} | |
| OP_LIST = list(PRECEDENCE.keys()) | |
| # helper function to get peek(1) | |
| def get_lookahead(tokens, ptr): | |
| if ptr + 1 >= len(tokens): | |
| return None | |
| else: | |
| return tokens[ptr + 1] |