This file contains 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
#include <arpa/inet.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <netdb.h> | |
#include <netinet/in.h> | |
#include <sys/socket.h> | |
#define case_return(ENUM_VALUE) case ENUM_VALUE: return #ENUM_VALUE; | |
const char* get_family(int f) { |
This file contains 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
import sys | |
priority = { '+': 1, '-': 1, '*': 2, '/': 2, '^': 3, '(': 0 } | |
def read_number(s, i): | |
return next((k for k,e in enumerate(s[i+1:]) if e in " +-*/^()"), len(s[i:]) - 1) + i + 1 | |
def read_string(s): | |
tokens = [] |
This file contains 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
import sys | |
priority = { | |
'+': 1, | |
'-': 1, | |
'*': 2, | |
'/': 2, | |
'^': 3, | |
'(': 0 | |
} |