New programming lang.
- bloodhound23
- Member
- Posts: 115
- Joined: Wed Jan 23, 2008 7:13 pm
- Contact:
Eh? A compiler that will be "like an assembler"? I really don't understand where you're coming from here.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....
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...
I remember a drawing my Software Engineering lecturer made on the blackboard. It went like this:JamesM wrote:Writing a compiler is a task on a par with if not more complex than writing an OS.
- 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.
Every good solution is obvious once you've found it.
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.
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.
Website: https://joscor.com
- AndrewAPrice
- Member
- Posts: 2299
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
Go to a college/university and do a programming course you're interested in: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....
- 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.
My OS is Perception.
-
- Posts: 6
- Joined: Sun Feb 10, 2008 3:11 am
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?)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)
-
- Member
- Posts: 118
- Joined: Mon May 05, 2008 5:51 pm
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.
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.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.
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).