File size: 694 Bytes
e1e2378
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# resonancenet_parser.py
# Parses .rnet resonance programs into executable internal structures

def load_resonance_program(file_path):
    try:
        with open(file_path, 'r') as f:
            program = f.read()
        return parse_resonance(program)
    except Exception as e:
        print(f"[ResonanceParser] Error loading file: {e}")
        return None

def parse_resonance(raw_text):
    lines = raw_text.splitlines()
    parsed = []
    for line in lines:
        line = line.strip()
        if line and not line.startswith("#"):
            parsed.append(tokenize(line))
    return parsed

def tokenize(line):
    return line.split()  # Very basic for now – can be extended later