Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

jumpjumpjump

making a compiler

This topic is 5373 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am working on making my own scripting language thing and I want to know if there is any way to write a compiler for it in VB.NET, is there and what are some good resources on making compilers? I have a few bookmarks on flipcode. i also have some C++ knowledge, if that helps. Boo!! I know all.

Share this post


Link to post
Share on other sites
Advertisement
Depending on how complex your scripting language is you may want to start out by mapping it out in EBNF. Then simply work out the EBNF in VB.

For example (not sure about the syntax):

digit := '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
// A Digit is either a 0, 1, 2, ... 8, or 9

number := digit[digit];
// A Number is one or more digits

expression := number '+' expression | number '-' expression;


This maps out a syntax for adding or subtracting 2 or more numbers

"2+34-2" or "5-2+44-342+1" are both valid strings

this would be implemented by doing creating a couple of functions :
IsDigit(), IsNumber(), and IsExpression()
Which would determine if the input string follows the EBNF guidelines.

Hope this helps.


[edited by - enfekted on January 23, 2004 8:20:34 PM]

Share this post


Link to post
Share on other sites
Writing compilers may not be a very suitable task for a beginner (as I will assume you are, posting in the For Beginners forum ...); it''s a large and complicated topic. In any case, the Dragon Book is the canonical book on the subject. Some people have also spoken favourably about Programming Language Processors in Java, which my university''s compiler course uses as a textbook (though as it turned out, the professor got most of his examples from the Dragon Book).

Share this post


Link to post
Share on other sites
quote:
Original post by jumpjumpjump
What is the best assembly language to use if i decided to try that?


The assembly language that your processor uses is not only best, but the only one that would work. Chances are thats x86, which would be Intel-like processors (Intel, AMD, etc.). For the sake of correctness, not all Intel processors are x86 but chances are you don't have one that isn't.

Edit: If you are a beginner, which as mentioned seems to be the case because of your posting in the For Beginners forum, a scripting language may not be a good project for you and assembly language may be a problem for you, too.

[edited by - Aerolithe on January 25, 2004 2:23:35 AM]

Share this post


Link to post
Share on other sites
By assembly language, do you mean a virtual machine which processes a list of opcodes and data?

Yo ucan write your own, incidentally i found this part relatively simple. The harder bit will be writing the lexical/syntax analyser

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!