0
101 Aug 04, 2006 at 13:50

I like game development. Really, I do. But I find sitting in front of a computer and programming in C/C++ all day very boring. So, here’s what I would like to do…

I would like to write my own compiler using C that would allow me to write games using a custom BASIC-like language. Of course, it wouldn’t be exactly like BASIC. It would include classes, inline assembly, etc. This same approach was taken by Naughty Dog for their Jak and Daxter series of games. They created a custom LISP variant called GOAL (Game Oriented Assembly Lisp).

I know that I would need to do what I originally said I didn’t want to do (sitting in front of a computer all day and programming in C/C++), but I’m willing to do that if it means I can use a powerful BASIC variant to program my games.

So, what exactly should I start with? Should I use Bison to parse the language? Does anyone know of a good compiler design tutorial? Is this even a good idea? :P

#### 36 Replies

0
101 Aug 04, 2006 at 14:13

Personally, I wouldn’t do it.

You’ll spend more time debugging your compiler than you will be making games, in my opinion.

If you were to do it, I’d take a look at something like ANTLR, bison/flex for the parsing. Perhaps Boost::Spirit, but I’d probably favour the earlier two.

0
101 Aug 04, 2006 at 14:17

You’ll spend more time debugging your compiler than you will be making games, in my opinion.

You’re right. But, this new language would be available for everyone to use. So my relentless debugging would help a lot of newbies who want to get into game development (yes… alright… I’m talking about myself here) :P

0
101 Aug 04, 2006 at 14:23

Community projects are great, and if you’re truly dedicated to writing this language, then perhaps it has a chance. Just keep in mind that the freely-available-software world doesn’t need another project that’s just going to get orphaned.

That said, have you looked at any of the other ‘starter’ programming languages targetted at game programming?

BlitzBasic? DarkBasic? PyGame?

If not, I highly suggest you do and see if any of those fill your needs. If they don’t, and you decide to go ahead with your own language, I suggest filling a niche that they don’t, otherwise you might find it harder to get a community together when you’ll be competing against these larger, established “easy-to-program” languages.

Disclaimer: I’ve never used any of those, but we do get a lot of posts from people who do, who are mostly newbies.

0
101 Aug 04, 2006 at 14:35

I’ve never tried BlitzBasic, but I do have some comments on DarkBasic and PyGame:

For me, DarkBASIC seems limiting. I don’t know why, but when I open up that ugly IDE, I just get the feeling that I’m in a box. With my language, I want it to be simple enough for a newbie, but powerful enough for the average programmer who’s had a few years of experience.

PyGame is nice, but Python is not my ideal language for writing games. I don’t like that just anyone can edit the source. Sure, it might be ok for some games that I just let people do what they want with, but Python isn’t for commercial games. I could use py2exe, but the programs it puts out are for Windows only and tend to be very large.

My main design hurdle right now is the decision on usability. Should the language be designed for games alone? Or should I include other functions/libraries that make it suitable for everyday application development? To me, designing it for game programming only would be slightly easier. But allowing general application development would make it available to a wider range of programmers.

What does everyone think?

0
101 Aug 04, 2006 at 15:41

I think it is a colossal waste of time, and here are my reasons why.

1. Have you written a compiler before?
2. Have you designed a language before?
3. If you want to program games, why waste at the minimum a year of your time, not programming games?
4. The more powerfull you make the language, without ‘limiting’ it as you say, you induce complexity, which in turns, makes it harder to use, which in turn, doesn’t make it newbie friendly.
5. What is so boring about C/C++ that would make your language such a joy to use?

I could go on, but I think I nailed a few key points there. I don’t want to be a downer on your idea, but it just seems far fetched, and not really worth your time.

0
101 Aug 04, 2006 at 19:03

@Nodlehs

I think it is a colossal waste of time, and here are my reasons why.

1. Have you written a compiler before?
2. Have you designed a language before?
3. If you want to program games, why waste at the minimum a year of your time, not programming games?
4. The more powerfull you make the language, without ‘limiting’ it as you say, you induce complexity, which in turns, makes it harder to use, which in turn, doesn’t make it newbie friendly.
5. What is so boring about C/C++ that would make your language such a joy to use?

I could go on, but I think I nailed a few key points there. I don’t want to be a downer on your idea, but it just seems far fetched, and not really worth your time.

Under no circumstances do I think it’s a collosal waste of time! Writing a compiler and virtual machine was the most fun coding I have ever done, and I encourache everybody to at least try it out! Especially in these times where every new game seems to have some form of scripting…

In response to 1 and 2: Peroxide script tutorials is where I learned the trade. The language is not the most complex, but it does work, and the framework is easy to expand. His ‘hello world’ example looks like this:

// A 'hack' to print a string from script.. send it via a 'setint' on the player as the name..
void printLog(string msg)
{
setint(TYPE_PLY, msg, 2, 0);
}

program helloWorld trigger_on_init
{
printLog("Hello world from PxdScript!");
}


and my expanded test script-code looks like this (built on his framework):

//
// The base class of all actors that can be controlled by players or AI,
// and collide with the world.
//
class Character expands Actor
{
// The character mesh (property means its a c++ variable, but can be changed by the scripts)
property Mesh mesh;

// The linked list of items being carried
Inventory inventory;

// The weapon currently in use
Weapon currentWeapon;

// TODO: Add functions for moving the character
// TODO: Add events for other characters entering/leaving view
// TODO: Add events for when sounds are heard

// Spawned event. Called by the engine when this character is created.
event Spawned
{
SetMesh("models/characters/test2.mesh");
}

// Touch event. Called by the engine when this actor touches another actor (overridden from class Actor)
event Touch(Actor other)
{
//super.Touch(other);
if(class(other) == class<Inventory>)
OnPickup( (Inventory)other );
}

// Play animation on current mesh (interface means it's an internal c++ function, callable from scripts)
interface bool PlayAnimation(string filename);

// Attach/detach an actor to a bone in the mesh
interface bool AttachToBone(Actor attachment, string boneName);
interface bool DetachFromBone(Actor attachment);

// This is called when a character collides with an inventory item
void OnPickup(Inventory item)
{
// TODO: Should have some rules for this...
// if(CanPickup(item))
{
Log("Picked up " + item.GetName());
}
}

// Adds a new item to the inventory
{
if(inventory == none)
inventory = item;
else
}

// Switch to the next weapon
bool SwitchToNextWeapon()
{
Weapon newWeapon;

// If the character already has a weapon, use it as the base
if(currentWeapon != none)
{
newWeapon = currentWeapon.Find( class<Weapon> );
if(newWeapon != none)
{
currentWeapon = newWeapon;
return true;
}
}

// Use inventory as base
newWeapon = inventory.Find( class<Weapon> );
if(newWeapon == none)
return false;

currentWeapon = newWeapon;
return true;
}

// Remove an inventory item from the list.
bool RemoveFromInventory(Inventory inv)
{
if(inventory == none)
return false;

if(inventory == inv)
{
inventory = inventory.next;
return true;
}
else
{
if(inventory.next != none)
{
for(Inventory i = inventory; i != none; i = i.next)
{
if(i.next == inv)
{
i.next = i.next.next;
return true;
}
}
}

return false;
}
}
}


This took about two moths to do, and that was while building the engine on the side.

I do not agree that making a language too powerful will make it complex, on the contrary. Making a powerful script language is all about removing the low-level stuff from the user, and make simpler high-level interfaces that they can use instead. A good example of this is UnrealScript’s networking architecture, where instead of having to write code for transferring data to and from the server, they simply mark what is to be sent, and what conditions have to be met for the transfer to occur. The compiler code to do this doesn’t even have to complex, just flag class-members as stated in the scripts, and have the runtime send it.

I too would also like to now what is so boring about C++? I use it all the time, and I love it!

0
101 Aug 04, 2006 at 19:09

[1] No, but I have to start somewhere. >_>
[2] No, but again, I have to start somewhere
[3] Because, as I said, I don’t like to write games in C. I like to write other stuff in C, just not games.
[4] Well, I’m not going to make it completely easy. That would just be another BASIC clone. I think Classes, trash collection, inline assembly, etc would be a good addition to the traditional BASIC language. But, newbies wouldn’t have to use those features if they didn’t want to. By “limiting”, I was speaking in terms of the feature set.
[5] When I’m writing a game, I like to think from the design side. C/C++ is just not the language for me when I try to make a game. If I had something simple, yet powerful, I’m sure making games would be a lot easier for me.

About my time… honestly, I have a ton of it. I’ve been thinking for the last 3 days about something I should work on. A compiler finally popped into my head and I decided to give it a try. Besides, who says you have to use it? Or anyone else? I’m really making it for my benefit because I think it would help me in the long run. If other people like it and want to use it, more power to them. When you say it’s a waste of time, you’re speaking from your point of view. But, here’s the thing… you’re not making the compiler. I am. So, it’s really up to me whether it’s a waste of time or not.

0
101 Aug 04, 2006 at 19:13

Half of the things I end up coding turn into wastes of time. That said, they’re wicked learning experiences.

I wrote my own compiler tools for some work-related language stuff, and it was a *pain*. That said, it was super interesting, and it helped me understand why gcc/cl do the things they do, and it was very rewarding.

I won’t rain on your parade, but just know that it *can* be very difficult. I do wish you luck however.

0
101 Aug 04, 2006 at 19:15

You could join an existing open-source Basic compiler project like Mattathias Basic which is a freeware sequel to Amos Basic on the old Amiga computers and an open-source counterpart to DarkBasic. We are aiming to make it cross-platform compliant so that it will still generate code for the next generation PowerPC-based Amigas as well as for PC. If you’re interested you might like to join the mailing list and read up on the progress first.

If you’re looking for something closed-source that will only work on Linux, Mac, and PC, you’re better off looking into buying BlitzMax instead. It’s object-oriented like Mattathias but broke the backward-compatability mold with their Amiga version to better support the PC.

0
101 Aug 04, 2006 at 20:50

A custom language doesn’t have to take a ton of time. I used Flex++ and Bison++ to generate my own compiler, and with no previous compiler building experience I have my own language in less than 3 months time.

0
101 Aug 04, 2006 at 21:12

@cypher543

[3] Because, as I said, I don’t like to write games in C. I like to write other stuff in C, just not games.

Fair enough, you don’t like that tool for that job.
@cypher543

[4] Well, I’m not going to make it completely easy. That would just be another BASIC clone. I think Classes, trash collection, inline assembly, etc would be a good addition to the traditional BASIC language. But, newbies wouldn’t have to use those features if they didn’t want to. By “limiting”, I was speaking in terms of the feature set.

Agreed, beginner developers would not need to use the more advanced features. But to create anything really deep, you would need to use those features. You can make it easier to interface with low level operations, agreed. I just don’t see why you don’t create a C++ class to do that for you, instead of an entirely new language. But, as you said, you don’t like using C to program games in.
@cypher543

[5] When I’m writing a game, I like to think from the design side. C/C++ is just not the language for me when I try to make a game. If I had something simple, yet powerful, I’m sure making games would be a lot easier for me.

From what you are saying, it sounds as if you are an experienced programmer, expecially if you are willing to takle creating a new language(with the feature set you have described). So, why are you finding it so difficult programming in C/C++ for games? What makes a game so much harder than other apps you have written? The design side should be very code non specific. You should never even talk about what language you are going to use in your game design. The eventual implementation of your design will have tons to do with C++, not the creating of the design itself.
@cypher543

About my time… honestly, I have a ton of it. I’ve been thinking for the last 3 days about something I should work on. A compiler finally popped into my head and I decided to give it a try. Besides, who says you have to use it? Or anyone else? I’m really making it for my benefit because I think it would help me in the long run. If other people like it and want to use it, more power to them. When you say it’s a waste of time, you’re speaking from your point of view. But, here’s the thing… you’re not making the compiler. I am. So, it’s really up to me whether it’s a waste of time or not.

Agreed, it is your time, you can do with it as you please. But you also asked on a forum what people though of your idea, your time. Don’t ask if you don’t want answers. I don’t think I was being rude in saying I thought it was a waste of time given your target goals, which is game programming, not tools programming(from the information you provided). If you indeed do feel that you are more interested in programming a language than go for it, it sounds like a great challange, and a blast. But if your goal is to program games? Then no, this is not worth your time.
@Kenneth Gorking

I do not agree that making a language too powerful will make it complex, on the contrary. Making a powerful script language is all about removing the low-level stuff from the user, and make simpler high-level interfaces that they can use instead.

From what I gathered he wasn’t talking about a simple scripting language, he was talking a fully featured programming language, his feature set seemed to indicate that as well. As I said above yea, you can reduce the complexity by making higher level interfaces to low level stuff, but in the end, your going to need to do more than basic read and writes, especially when it comes to games programming. Like inline assembly, he wants that, how is that easier in his proposed language than in C++?

Cypher, in the end, it comes down to, do you want to program games right now, or later? If you want to program games right now, then this is a waste of your time, as you won’t be programming games for quite a while(going under the assumption this is a fully featured language, not just a limited feature set scripting language). If you can wait, and you really like the idea of your proposed language, then go for it, it sounds like it would be a good time.

0
102 Aug 05, 2006 at 01:17

@cypher543

They created a custom LISP variant called GOAL (Game Oriented Assembly Lisp).

I’d just like to add that creating a variant of Lisp is a whole different ball-game than creating a completely different language compiler. Search around for LISP and “Domain Specific Languages”. Lisp programmers tend to morph the language to suite there needs, rather than create a whole new language.

I’m not trying to dissuade you, but I don’t think the Jak and Daxter’s guys went the the trouble of a lexer and parser. They probably used the Lisp compiler and directly editited the code tree with macros.

0
101 Aug 05, 2006 at 02:36

I don’t think I was being rude in saying I thought it was a waste of time given your target goals, which is game programming, not tools programming(from the information you provided).

I’m sorry if I sounded annoyed. I didn’t think you were being rude, at all. My target goal isn’t really game programming, it’s making game programming easier for myself and for people like me who tend to not get the whole process.

Anyway, I think what I’m going to do is just write the basic compiler, then expand it with an OpenGL library. That way, people can write their own engines for it. Maybe I’ll work on my own, that way newbies have something to work with. I know this is going to take awhile, but I’m so completely bored right now, and I need some exciting to do. :P

0
101 Aug 05, 2006 at 05:05

I would say it would be well worth your time then, since you seem to want to focus more on a game language, rather than game development itself.

Before you begin, it would be good to check out what some of the other game programming scripting languages do, and check on their forums to see what people do/don’t like. That would give you a good idea of possibly where to start when implementing a feature set.

0
101 Aug 05, 2006 at 08:05

If you want to start some where you should buy a thew good books on the subject, there is no substitute for this as online resources are generally sparse and/or poor. Tutorials are not enough, you need to understand theory aswell, i suggest starting here.

Lastly do yourself a favour and use a more appropriate programming language for this such as SML, O’Caml, or haskell.

0
101 Aug 05, 2006 at 10:02

snk_kid: you keep amazing me with good links about language ponderings..I had almost given up on finding those..there really isn’t much good stuff(or it’s hard to find) dealing with “new” languages..
thx

0
101 Aug 05, 2006 at 14:22

Lastly do yourself a favour and use a more appropriate programming language for this such as SML, O’Caml, or haskell.

I would… if I knew them. It’s taken me a very long time to get used to C. Besides, I think Flex/Bison look very cool, and I doubt they generate lexers and grammar for SML, O’Caml, or haskell.

0
101 Aug 05, 2006 at 15:36

@cypher543

I would… if I knew them. It’s taken me a very long time to get used to C.

These languages are more declarative which is one of the points so they shouldn’t take any where near as long as C/C++ besides SML & O’Caml allow you to mix imperative code with functional.

The only thing which may have a slight learning curve (which depends on yourself) is learning functional concepts/practices (i don’t mean procedural, not the samething) such as

• functions are values too (there first-class entities)
• higher-order functions (functions which take or return functions because “functions are values too”)
• lamdba functions/expression (anonymous/unnamed functions)
• The recursive operators (patterns of recursion and higher-order functions) such as folds, unfolds, iterate, map, zip, etc, etc.
• Currying and/or partial application (not paritial evalution), function composition.

Once you’ve got your head wrapped around these concepts the rest will just be learning syntax which is 1 a day job.
@cypher543

Besides, I think Flex/Bison look very cool, and I doubt they generate lexers and grammar for SML, O’Caml, or haskell.

Each of those language have there own versions of lex & yacc (which is what flex & bison desecend from). C is just awful for compiler development even when you have tools to help out. Don’t let the fact that GCC is written in C make you think otherwise because it really is a bad idea and it doesn’t mean you can’t write a GCC front-end in any language because you can so it’s all mute.

Don’t use the wrong tool for the job.

0
101 Aug 05, 2006 at 16:26

The first place to start when creating a custom language (IMO) is the dragon book (it’s proper name is “Compilers: Principles, Techniques and Tools”). It is the classical reference, and doesn’t cover new or really advanced stuff. You might want to look at “Advanced Compiler Design and Implementation” by Muchnick, “Engineering a Compiler” by Cooper and “Programming Language Pragmatics” by Scott, but I don’t know these books. Then there is alot of stuff on the .net.

0
101 Aug 05, 2006 at 17:27

I’d love to read the Dragon book, but I don’t really have the money for it, yet. I spent all that I had on 3 domain names and a hosting payment. :P

snk_kid: I’m reading some tutorials on SML. It looks pretty good. Can you recommend some good reading materials for it?

Also, what’s the best lex and yacc SML port? I’ve seen mlLex and mlYacc, but are they the only ones?

0
101 Aug 05, 2006 at 20:17

@cypher543

snk_kid: I’m reading some tutorials on SML. It looks pretty good. Can you recommend some good reading materials for it?

SML is a good choice for someone like you, one thing to note is SML and O’Caml are related they are both descendents of the ML family. SML is mainly a standardization of ML (hence the S in SML for standard) while O’Caml derives from ML with some (very) subtle changes and has other features/language extensions including support for OO. So starting SML should make things simplified but it’s still an expressive and powerful language.

If you can get your hands on it ML for the Working Programmer, 2nd Edition is good book for someone like yourself.

Some resources on functional programming in general(not necessarily in SML):

@cypher543

Also, what’s the best lex and yacc SML port? I’ve seen mlLex and mlYacc, but are they the only ones?

I’m not so sure, try checking the ML-faqs.

0
101 Aug 05, 2006 at 20:49

Well, I successfully ported my Lex file to the ml-lex format. But I really have no idea what to do now. :P I know what I need to do with the C versions of lex and yacc, but the SML ports don’t seem to be made the same way. With my C tests, a simple -ll parameter spit out an executable that let me test my lex file. But it looks like I have to write my own for SML. Since I’m new to it, I dunno how to do that, exactly. :(

0
101 Aug 05, 2006 at 21:30

Did you read the documentation that comes with both ml-lex/yacc?

This might be useful: User’s Guide to ML-Lex and ML-Yacc

0
101 Aug 05, 2006 at 23:07

thanks! That guide is really helping! :D

0
101 Aug 06, 2006 at 10:41

You should probably check out FreeBasic.

Suposedly fast, and with inline asm.

0
101 Aug 06, 2006 at 14:47

geon: I have, and thanks. But I’d like the experience of writing my own.

Everyone: I started working on it last night, and at the moment, I have a simple app that takes source code and breaks it down into tokens. Yeah… that’s all. But it’s a start.

I’ve trying to get a name for it, too. I liked “lambda” (the mathmatical symbol and logo for Half-Life), but it’s already a programming language. :( So, I dunno. Any ideas?

0
101 Aug 06, 2006 at 18:16

0
102 Aug 06, 2006 at 18:23

How about the “cypher” language? ;)

BTW, are you doing a design before diving into this? Perhaps defining the syntax in EBNF would be helpful.

Edit: Fixed the Extended Backus-Naur Form (EBNF) acronym.

0
101 Aug 06, 2006 at 18:48

(the mathmatical symbol and logo for Half-Life)

;) Also, it’s not “lambada”. It’s “lambda”. Besides, I can’t call it that anyway, since it’s already a programming language. Oh well.

Erm. I don’t think so. :p

BTW, are you doing a design before diving into this? Perhaps defining the syntax in EBF would be helpful.

Yes, I’ve designed the syntax. I really have no clue was EBF is. There’s nothing on google or wikipedia. *shrugs* The syntax will be closely related to C, in that it uses brackets to enclose code after keywords such as “if, else, elif, while”, etc. The keywords, however, will relate more to the style of BASIC. For example, a simple loop would look like:

i = 2
while not i = 32 {
i = i * 2
output "Value of i is " + i
}


That would multiply i by 2 until it’s value becomes 32. Happy?

EDIT: I also found out what else the lambda symbol stands for… which is one reason why I’m not going to use it.

0
101 Aug 06, 2006 at 19:36

@cypher543

Yes, I’ve designed the syntax. I really have no clue was EBF is. There’s nothing on google or wikipedia.

He probably meant EBNF which is an extension of BNF, you should know what it is, they’re used to describe context-free grammars.

0
102 Aug 06, 2006 at 21:08

Sorry, I mistyped the acronym. It stands for (Extended) Backus-Naur Form. That’s the name of the guys credited with coming up with it. It’s a great way for describing the syntax of a language. You can find a good introduction here.

If you’ve looked at boost::spirit then I’m sure you’ve seen this. That library attempts to allow BNF to be used in C++ to create a parser.

For example, the following is the complete EBNF description of the Lua langauge syntax:@

chunk ::= {stat [;´]} [laststat [;´]]

block ::= chunk

stat ::= varlist1 =´ explist1 |
functioncall |
do block end |
while exp do block end |
repeat block until exp |
if exp then block {elseif exp then block} [else block] end |
for Name =´ exp ,´ exp [,´ exp] do block end |
for namelist in explist1 do block end |
function funcname funcbody |
local function Name funcbody |
local namelist [=´ explist1]

 laststat ::= return [explist1] break

funcname ::= Name {.´ Name} [:´ Name]

varlist1 ::= var {,´ var}

 var ::= Name prefixexp [´ exp ]´ prefixexp .´ Name

namelist ::= Name {,´ Name}

explist1 ::= {exp ,´} exp

 exp ::= nil false true Number String …´ function prefixexp tableconstructor exp binop exp unop exp
 prefixexp ::= var functioncall (´ exp )´
 functioncall ::= prefixexp args prefixexp :´ Name args
 args ::= (´ [explist1] )´ tableconstructor String

function ::= function funcbody

funcbody ::= (´ [parlist1] )´ block end

 parlist1 ::= namelist [,´ …´] …´

tableconstructor ::= {´ [fieldlist] }´

fieldlist ::= field {fieldsep field} [fieldsep]

 field ::= [´ exp ]´ =´ exp | Name =´ exp exp

fieldsep ::= ,´ | ;´

 binop ::= +´ | -´ *´ | /´ \^´ | %´ ..´ <´ | <=´ >´ | >=´ ==´ | \~=´ and or

unop ::= -´ | not | `#´

With just that information, anyone should be able to go off and write a parser for Lua. If you had a BNF description of your language syntax, then it would be easier to consicely relate it to others.

0
101 Aug 06, 2006 at 21:26

@monjardin

If you had a BNF description of your language syntax, then it would be easier to consicely relate it to others.

The fact that he/she is using a yacc like parser generator should indiciate that he using a BNF like DSL already. If he/she doesn’t realize this then i would be slightly concerned ;).

0
101 Aug 06, 2006 at 21:53

Writing parsers/compliers is much more fun when you haven’t had any actual training in it (like reading the dragon book). You come up with all kinds of odd solutions (not nessecarly better) like data driven rather than state driven compliers.

I’d highly suggest if you want to do this that you write a complier that generates C code and not direct assembly. It’ll elimitate all of the various hardware related issues and be easier to get running at first. You’ll also have a lot of handy debug output.

0
101 Aug 07, 2006 at 07:34

@Vandervecken

I’d highly suggest if you want to do this that you write a complier that generates C code and not direct assembly. It’ll elimitate all of the various hardware related issues and be easier to get running at first. You’ll also have a lot of handy debug output.

I’d highly suggest only writing a compiler front-end, targeting some compiler backend like GCC. Doing this will make things much more easier, you could probably come up with a compiler in matter of hours just doing:

1. Lexer.
2. Parser.
3. Semantic analysis
[LIST=2]
4. Symbol tables.
5. Type Checking.

[*]Convert AST to intermediate representation of backend.
[/LIST]

0
101 Aug 07, 2006 at 09:51

@cypher543

I’d love to read the Dragon book, but I don’t really have the money for it, yet. I spent all that I had on 3 domain names and a hosting payment. :P

Yes, these books are way overpriced.. That’s why you should always live close to a university with a decent library… :)

0
101 Aug 07, 2006 at 09:54

hm..it seams he want’s to have some fun just doing it..so maybe you should give him a chance to run into some walls, come back and ask some questions.
He’ll realize himself what can be done with his language and what not as well as what works.
I agree that if you just wanted to create a compiler for an already specified language you’d best use a backend creating the parser with some lexx/yacc combination.
In order to learn something it might actually be better to try and do it all yourself and later replace the various bits with the ‘professional’ libs.

It does sound a bit as if you’re making the language up as you progress doing the compiler. That is totally ok in order to play with different constructs etc. Just don’t exspect too many ppl to jump on it until you have a well defined and stable language that is neatly integrated with lot’s of tools. Eventually you will find yourself rewriting either some sort of DarkBasic or C++. Most languages have evolved a long time..to become what they are today. Maybe they could be a bit cleaner in places but they carry some backward compatiblity burden. But they DO WORK. And it is quite tricky to design a language that is not just a clone of a working language that aktually works in all the cases the programmer might devise.

Anyways..good luck and have fun :)