Collect function declaration symbols

This commit is contained in:
2024-09-20 13:32:24 +02:00
parent c9ff4f0a2a
commit 0a8d3fce2f
4 changed files with 117 additions and 110 deletions

View File

@ -25,11 +25,13 @@ main = execParser commandLine >>= withCommandLine
>>= withParsedInput defaultOutput
. runParser programP input
withParsedInput output (Right program) =
let symbolTable = nameAnalysis program
_ = typeAnalysis symbolTable program
intermediate' = intermediate symbolTable program
in elfObject output
$ riscv32Elf
$ generateCode symbolTable intermediate'
either print (withSymbolTable output program)
$ nameAnalysis program
withParsedInput _ (Left errorBundle) = putStrLn
$ errorBundlePretty errorBundle
withSymbolTable output program symbolTable =
let _ = typeAnalysis symbolTable program
intermediate' = intermediate symbolTable program
instructions = generateCode symbolTable intermediate'
in elfObject output
$ riscv32Elf instructions