예제 #1
0
        private static void InitializeSymbolTable(string sourcePath)
        {
            using var sr = new StreamReader(sourcePath);
            string line;

            while ((line = sr.ReadLine()) != null)
            {
                line = line.TrimStart();
                if (IsInstruction(line))
                {
                    SymbolTable.Index++;
                }

                if (!Parser.IsLabel(line))
                {
                    continue;
                }

                var symbol = Parser.GetLabel(line);
                SymbolTable.Add(symbol);
            }
        }