LogFAQs > #882302722

LurkerFAQs, Active DB, Database 1 ( 03.09.2017-09.16.2017 ), DB2, DB3, DB4, DB5, DB6, DB7, DB8, DB9, DB10, DB11, DB12, Clear
Topic List
Page List: 1
TopicI wrote a C++ interpreter
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!
Topic List
Page List: 1