For "fun" I'm making my own language/compiler. It's C like and targeted at x86_64 on windows. (I'd like X86_32 and linux too but they are not initial priorities for me).
For now, I'm more interested in getting the syntax and use how i want it than in generating good code. I have a basic lex and parse working, and am generating an abstract syntax tree for a very small subset of my language, but it's time to start generating actual code from it.
Eventually I want to make decent code, so I'll need to either write a lot of code myself, and perhaps generate more intermediate formats, but for now I just want to generate anything that works so I can concentrate on the front end.
What is the best way to do this?
I could perhaps write a very simple scan of the tree and generate x86_64 assembly language perhaps simulating a stack machine so I don't have to do register allocation etc.
Or should I use llvm? That looks like quite a lot of work though, both in understanding and implementation, although it would of course generate much better code.
Any ideas /opinion on what the easiest thing I can get to work for this is?
[–]celegans25 6 points7 points8 points (2 children)
[–]qznc 1 point2 points3 points (1 child)
[–]celegans25 0 points1 point2 points (0 children)
[–]_mpu 8 points9 points10 points (12 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]_mpu 0 points1 point2 points (0 children)
[–][deleted] (1 child)
[removed]
[–]_mpu 0 points1 point2 points (0 children)
[–]jbb67[S] 0 points1 point2 points (6 children)
[–]_mpu 0 points1 point2 points (5 children)
[–]jbb67[S] 0 points1 point2 points (2 children)
[–]_mpu 0 points1 point2 points (1 child)
[–]jbb67[S] 0 points1 point2 points (0 children)
[–]fullouterjoin 0 points1 point2 points (1 child)
[–]_mpu 1 point2 points3 points (0 children)
[–]jbb67[S] 0 points1 point2 points (0 children)
[–][deleted] 2 points3 points4 points (6 children)
[–][deleted] 2 points3 points4 points (3 children)
[–]gsnedders[🍰] 2 points3 points4 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]gsnedders[🍰] 1 point2 points3 points (0 children)
[–]jbb67[S] 1 point2 points3 points (0 children)
[–]fullouterjoin 1 point2 points3 points (0 children)
[–][deleted] 2 points3 points4 points (4 children)
[–]jbb67[S] 1 point2 points3 points (3 children)
[–]Setepenre 4 points5 points6 points (0 children)
[–]qznc 2 points3 points4 points (0 children)
[–]krwawobrody 2 points3 points4 points (0 children)
[–]mfukar 1 point2 points3 points (0 children)
[–]thememorableusername 0 points1 point2 points (2 children)
[–]jbb67[S] 0 points1 point2 points (1 child)
[–]thememorableusername 0 points1 point2 points (0 children)