Logbook
Logbook
PROGRAM :
import re
def lexical_analyzer(code):
# Splitting code into tokens
tokens = re.findall(r'\w+|\S', code)
# Categorizing tokens
headers = []
found_keywords = []
found_operators = []
found_punctuations = []
found_constants = []
found_identifiers = []
OUTPUT :