|
|
|
|
![]() ![]() |
Oct 9 2004, 08:07 AM
Post
#1
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 189 Joined: 9-October 04 Member No.: 1,550 |
I got this assignment from my college:
To create a working Compiler or Interpreter You need to design your own Language And build the compiler using Java or preferably C. This is one scary nightmare...dang....I wish I can just wake me up... but I can't this is not a nightmare. T_T Btw, does anyone here has any experience on creating compiler or interpreter using C? I am designing a language which is the combination of C and PHP. And I need help. |
|
|
|
Oct 9 2004, 03:49 PM
Post
#2
|
|
|
Newbie [Level 1] ![]() Group: Members Posts: 10 Joined: 9-October 04 Member No.: 1,570 |
Hi;
Any more parameters for this assignment? number of statements, functions etc.. it sounds hard, but just take a deep breath... start with the actual syntax: identifiers, functions, operators, separators, etc... decide what legal and illegal syntax is then write your pattern-matching code to look for these things now that you can identify the parts of your language, all you need to do is translate it to C and compile and voila, u r done. start with a simple arithmetic language, i.e. make sure the operators are infix (or postfix or prefix or whatever u like). make sure the operands are valid (i.e. numeric) now expand it by adding variables. make sure variables are declared before being used. i think u see where I am going now... good luck! - arp |
|
|
|
Oct 10 2004, 12:55 PM
Post
#3
|
|
|
Newbie [Level 1] ![]() Group: Members Posts: 19 Joined: 10-October 04 Member No.: 1,626 |
Hi!
I wrote C interpreter, Pascal interpreter, Icon interpreter, C->Pascal translator and C->ICON translator (everything in ANSI C) You should read something about Flex/Bison (lex/YACC) (use google to find it) -- eldeo |
|
|
|
Oct 29 2004, 03:57 AM
Post
#4
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 178 Joined: 13-October 04 From: NSW, Australia Member No.: 1,713 |
wow thats brave
|
|
|
|
Nov 17 2004, 07:02 AM
Post
#5
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 351 Joined: 19-October 04 From: India Member No.: 1,824 |
yeah....
first of all design the syntax... and get the patterns/ regular expressions to identify the tokens( identifier/variable, constructs, expressions etc). you can then use lex to generate a program which reads the source and generates the tokens... call this program from your program.. now that u have the tokens... process then in your program accordingly.... I have heard of yacc but never used it... just find out more abt it and c if that would help... all the best... rest assured that though it is difficult, it would be very satisfying once u c the result.... |
|
|
|
Aug 21 2008, 10:04 AM
Post
#6
|
|
|
Trap Double Mocha Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 2,360 Joined: 21-September 07 Member No.: 50,369 |
How to create C compiler
Creating a Compiler Replying to eldeoReplying to eldeo Hello Mr.Eldeo .I am sathees and I am studying fourth year IT (UG) in PSG college of technology coimbatore Tamil nadu.I am assigned a project of creating a 'C' compiler. Can you please help me to create a model C compiler. -question by satheesaran |
|
|
|
Aug 28 2008, 10:43 AM
Post
#7
|
|
|
Newbie [Level 1] ![]() Group: [HOSTED] Posts: 14 Joined: 28-August 08 Member No.: 66,981 |
Well, firstly, do not resurrect old threads.
Anyway... What do u mean, a 'C' compiler? A compiler written in C or a compiler that converts C -> executable file? For the first one... try reading some of the posts above, they are really useful. Any in-detail questions? |
|
|
|
![]() ![]() |
Similar Topics
| Topics | Topics | |
|---|---|---|
|
|
|
|
Lo-Fi Version | Time is now: 7th October 2008 - 10:06 PM |