Page 4 of 4
Posted: Fri Feb 08, 2008 3:57 pm
by bloodhound23
I have decided to make a compiler that will be like fasm except for the fact that it is high level. I really need to learn to stick with things....
Posted: Sun Feb 10, 2008 3:53 pm
by pcmattman
Sticking with things is much easier if you pick a project that isn't quite so big... And if you take the time to actually think about what you will do instead of winging it
.
Posted: Wed Feb 13, 2008 2:59 am
by JamesM
bloodhound23 wrote:I have decided to make a compiler that will be like fasm except for the fact that it is high level. I really need to learn to stick with things....
Eh? A compiler that will be "like an assembler"? I really don't understand where you're coming from here.
Do you mean a HLA (high level assembly) language? In which case there are already assemblers around.
Also, do you quite grasp how difficult creating a compiler (of a non-regular language) is? Assembling is the easy part. You've got the front-end parser which constructs a parse tree, you've got to simplify that to an abstract syntax tree, then use some sort of intermediate representation to perform optimisations, then convert that IR back into target code, with the proper addressing modes etc.
Writing a compiler is a task on a par with if not more complex than writing an OS. Be careful not to bite off more than you can chew, especially considering your "Learning C" post...
Posted: Wed Feb 13, 2008 7:22 am
by Solar
JamesM wrote:Writing a compiler is a task on a par with if not more complex than writing an OS.
I remember a drawing my Software Engineering lecturer made on the blackboard. It went like this:
- A one-shot tool written for personal use has a complexity of 1.
- A generic tool is x3 more complex than a one-shot one.
- A tool for the general public is x3 more complex than one for personal use. (Robustness, intuitivity, ...)
- A compiler is a generic tool for the general public, but x4 as complex.
- An OS is x4 as complex as a compiler.
Don't nail me to those numbers, but IMHO the general idea is correct.
Posted: Wed Feb 13, 2008 7:38 am
by 01000101
I agree.
I'm not saying that creating a compiler is easy, by no stretch of imagination is it that, but it is not on par with creating an operating system.
Posted: Wed Feb 13, 2008 6:02 pm
by AndrewAPrice
bloodhound23 wrote:I have decided to make a compiler that will be like fasm except for the fact that it is high level. I really need to learn to stick with things....
Go to a college/university and do a programming course you're interested in:
- Having a due date and set guidelines/requirements about what to do will motivate you to finish.
- You'll come out with a fancy certificate or degree.
Posted: Thu Feb 14, 2008 7:08 am
by binutils
all complex/difficult problem is nothing after you knows it.
It is just so simple and easy.
Between the know and dunno is real stiffy learning curve.
Posted: Thu Feb 14, 2008 9:23 am
by bucket_brigade
i once written a compiler for a variant of pascal in lisp and it was fun (had todo it for a uni course)
Posted: Fri May 02, 2008 10:49 pm
by Shark8
bucket_brigade wrote:i once written a compiler for a variant of pascal in lisp and it was fun (had todo it for a uni course)
Interesting. Do you still have the source? I intend to learn Lisp and Prolog sometime, mainly because they aren't imperitive/procedural languages and thus expand my programming experience. (And since I mostly program in Delphi/Pascal that compiler of yours should be instructive, right?)
Posted: Mon May 05, 2008 6:59 pm
by chezzestix
I often see in this topic talk of Machine being hard but I honestly don't see the complication. I, in some ways, prefer to program straight hex instructions. Of course I use a disassembler to make things easier as far as command variants go but it just takes a little more thought to get something done in Machine. I would be glad to provide assistance on this project. I will not commit to a project for fear I will drop my own studies but I certainly will help where needed.
Posted: Mon May 05, 2008 10:00 pm
by iammisc
Solar wrote:
# A one-shot tool written for personal use has a complexity of 1.
# A generic tool is x3 more complex than a one-shot one.
# A tool for the general public is x3 more complex than one for personal use. (Robustness, intuitivity, ...)
# A compiler is a generic tool for the general public, but x4 as complex.
# An OS is x4 as complex as a compiler.
I disagree. I think that a compiler is as easy as a tool for the general public. Notice, however, I didn't say what kind of compiler.
For example, I wrote a compiler for a rather high level language that compiled to high-level bytecode that ran on a high-level interpreter. That was really easy cause each statement mapped exactly to one instruction.
However, writing a compiler to machine code is definitely a challenge as I have learned as I am writing a JIT specializer for this high-level language(along the lines of psyco).