diff options
| author | Eugen Wissner <belka@caraus.de> | 2024-09-20 13:32:24 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2024-09-20 23:00:07 +0200 |
| commit | 0a8d3fce2f2797b95b22ea3577d2514621c850fc (patch) | |
| tree | 8112b289ec1d5cd4b95207b5f299718159cbdb8c /src/Main.hs | |
| parent | c9ff4f0a2a2cfa31964a307c08f9baa349565bbd (diff) | |
| download | elna-0a8d3fce2f2797b95b22ea3577d2514621c850fc.tar.gz | |
Collect function declaration symbols
Diffstat (limited to 'src/Main.hs')
| -rw-r--r-- | src/Main.hs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/Main.hs b/src/Main.hs index 646d967..a993e98 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -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 |
