Poll of the Day > I wrote a C++ interpreter

Topic List
Page List: 1
Yellow
07/04/17 5:02:44 AM
#1:


UTth4Pa

I wanted a more versatile version of cheat codes, so I'm made them. Instead of a string of numbers, you add a script that executes every frame. It's interpreted as well, so it's just text you handle.

Think the accessibility of cheat codes with the versatility of a real coding language.

That's a test script on the right. Most basic commands work atm, not all of them are shown.

One day I'll design my own language for fun.
---
... Copied to Clipboard!
Duck-I-Says
07/04/17 5:09:09 AM
#2:


What kind of parser did you use? The furthest I got into parsing complex syntaxs, in my case Java, was a recursive decent parser based on a subset of the Java syntax specification. Not exactly efficient or extensible, but it was easy and got the job done.
... Copied to Clipboard!
Yellow
07/04/17 5:27:16 AM
#3:


Duck-I-Says posted...
What kind of parser did you use? The furthest I got into parsing complex syntaxs, in my case Java, was a recursive decent parser based on the Java syntax specification. Not exactly efficient or extensible, but it was easy and got the job done.

Parser.. so a parser for math strings like "1+9"? I made my own math parser. It was a pretty decent headache, but I even got variables working as well as recursive logic for parenthesis. Sorry, I'm not big on the computer science lingo. My math parser is pretty inefficient as well, but I'm leaving well enough alone for now. Since it's not a real fleshed out interpreter I'm just covering the basics. I doubt I'll ever need strings, let alone classes namespaces or additional dependencies.

The mistake I made on my first interpreter was dealing with text the whole way through executing the script, this time I just made an object array that contained data for every command. This is much much faster and easier. I think my first interpreter was made the first time I used C++, so there were a lot of mistakes.

Also in my language, you don't declare anything and everything is a double, even arrays, which don't have any real limit (assuming you don't actually use all of the space). Good enough for my needs really.
---
... Copied to Clipboard!
Magus 10
07/04/17 7:18:56 AM
#4:


Yellow posted...
Also in my language, you don't declare anything and everything is a double, even arrays, which don't have any real limit (assuming you don't actually use all of the space). Good enough for my needs really.


I'm a little confused, is it a C++ interpreter, or is it an interpreter for a language you created?
---
Internet = Tube0 + Tube1X + Tube2X^2/2! + Tube3X^3/3! + Tube4X^4/4! + ...
... Copied to Clipboard!
thecolorgreen
07/04/17 9:48:56 AM
#5:


Magus 10 posted...
Yellow posted...
Also in my language, you don't declare anything and everything is a double, even arrays, which don't have any real limit (assuming you don't actually use all of the space). Good enough for my needs really.


I'm a little confused, is it a C++ interpreter, or is it an interpreter for a language you created?


Well the code on the right isnt c++
---
:wq
... Copied to Clipboard!
TheWorstPoster
07/04/17 10:04:34 AM
#6:


I wish I had something like this for my Java class, instead of having to do System.Out.PrintLn(Variable); as well as commenting for each thing I wanted tested. One of the (few) things I liked about my C# and VB.NET classes, since we used Visual Studio, and are able to step through every line and see exactly what the logic does (which also, admittedly, did not help much, as I was a far less experienced coder back then).
... Copied to Clipboard!
RoboXgp89
07/04/17 10:06:24 AM
#7:


TheWorstPoster posted...
I wish I had something like this for my Java class, instead of having to do System.Out.PrintLn(Variable); as well as commenting for each thing I wanted tested. One of the (few) things I liked about my C# and VB.NET classes, since we used Visual Studio, and are able to step through every line and see exactly what the logic does (which also, admittedly, did not help much, as I was a far less experienced coder back then).


I found eclipse to be cumbersome I only used it to import other languages into and work on them
i found blu_j for java is exceptionally well though would probably be frowned upon in an office enviroment
you can debug in blu jay
---
This is the most positive thing I can post on a site that furrows their brow at nothing.
https://www.youtube.com/watch?v=a4NuopZzdPc
... Copied to Clipboard!
TheWorstPoster
07/04/17 10:12:46 AM
#8:


RoboXgp89 posted...

I found eclipse to be cumbersome I only used it to import other languages into and work on them
i found blu_j for java is exceptionally well though would probably be frowned upon in an office enviroment
you can debug in blu jay


I used Android Studio first (which doesn't offer this), when I took Mobile Programming (which was an elective, although I believe that it should have be a mandatory class), which it did not offer that (as far as I was concerned), which is my first time I used Java. When I took my Java class next semester (same professor) as well as JavaScript, I used TextPad8, which also doesn't offer that (but it was easier for JavaScript, since browsers offer step-throughs).
... Copied to Clipboard!
Yellow
07/04/17 5:07:17 PM
#9:


Magus 10 posted...
Yellow posted...
Also in my language, you don't declare anything and everything is a double, even arrays, which don't have any real limit (assuming you don't actually use all of the space). Good enough for my needs really.


I'm a little confused, is it a C++ interpreter, or is it an interpreter for a language you created?

Well, it's a basic C interpreter that loosely follows the rules of C. There are a couple differences.

The semicolon in "if (); {}" isn't supposed to be there, but that's a little compiler trick I think. If () counts as its own command and ignores the scope, it just knows that it should skip the next scope.

There are also no functions or dependencies, so it's like a barebones language based off C++.
---
... Copied to Clipboard!
Topic List
Page List: 1