Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

how do i wrote interpreter?

Name: Anonymous 2006-04-26 2:08

I want to implement a scripting language in my project.

I don't want to use Lua, even though it's the easiest way I know how.  Instead, I want to write my own scripting language interpreter into my program.

I've a B.S. degree in Computer Science so I know most of the fundamentals, but not the advanced practicalities.  For example, I can probably write up a formal grammar for whatever scripting language I wish to use -- but ... then what?  How do I apply that knowledge, to what I wish to do?

Any good sources on this subject that isn't targeted towards Ph.Ds with Masters Degrees, but good enough for someone with a B.S. degree level of education?

Name: Anonymous 2006-04-26 4:47

Use Python lol

Seriously, you need to check Flex and Bison first.

Name: Anonymous 2006-04-26 6:18

Name: Anonymous 2006-04-26 6:28

>>1
Implement SBN, it's a few lines and you have a scripting engine. Add special values for interacting with your application.

Name: Anonymous 2006-04-26 7:15

The most important question here is why you don't want to use Lua? Why are you reinventing the wheel?

There are several decent compiler books that are now out of print and are thus available on the Internet for free from their authors. Thirty seconds of searching will turn them up.

Name: Anonymous 2006-04-26 9:23

How do I shot web?

Name: Anonymous 2006-04-26 9:52

sablecc is nice for java

Name: Anonymous 2006-04-26 9:58 (sage)

>>7
gtfo

Name: Anonymous 2006-04-26 12:56

>>5

Lua is best suited to small-scale event scripting -- it CANNOT do everything C's or LISP's built-in standard syntax can unless you import runtime libraries into your program (written in C).  Something as simple as re-writing the Mersenne Twister algorithm, ended up a syntactic nightmare.

Name: Anonymous 2006-04-26 15:19

>>2
I never understood how to use flex and bison.  Their documentation seems targeted toward people who already know the syntax of the files flex and bison read.

>>3
But this seems more pragmatic and user-friendly to someone like myself.  I'll try it out, thank you.

Name: Anonymous 2006-04-26 15:22

>>9
Well, that's the point of embedding a language. You provide an interface with the functions you need, so for example, Farcry provides the AI interface to Lua and Paint Shop Pro provide graphics and window functions to Python.

I don't know Lua, but I can tell one thing - it's not necessarily aimed at small scale things.

Name: Anonymous 2006-04-26 16:12

If you want a fast, powerful and lightweight scripting system, you should look into Squirrel.
Pawn is aparently good too, so is Lua. I like python too.

Name: Anonymous 2006-04-26 18:08

use sablecc

Name: Anonymous 2006-04-26 18:22

Lua is best suited to small-scale event scripting -- it CANNOT do everything C's or LISP's built-in standard syntax can unless you import runtime libraries into your program

First off, that's total horseshit. I don't think you know what you're talking about. But, for the sake of argument, I'll assume that's true.

So, let me get this straight: instead of importing these libraries, or adding hooks inside your program, you want to make an entirely new language, as well as the associated libraries (they won't write themselves, you know)? And you've never even written your own compiler before, or designed a language?

You, sir, are a first class idiot with a bad case of "Not Invented Here". I guarantee any solution you come up with will never touch Lua, or any other widespread embedded language, and you'll never finish your project either.

Name: Anonymous 2006-04-26 18:26

PS. What the fuck are you doing writing the Mersenne twister in Lua? PRGN are slow at the best of times, writing it in anything non-native is pure retardation.

Name: Anonymous 2006-04-26 20:27

>>14

"Hey Roberto Ieruschamily, why the fuck are you making this 'Lua' language anyhow?  You, sir, are a first class idiot with a bad case of NOT INVENTED HERE.  I guarantee any solution YOU come up with will never touch LISP.  Blah blah blah now excuse me while I suck on a black cock."

Name: Anonymous 2006-04-26 20:53

>>16
You're not Roberto Ierusalimschy, dumb shit. You don't have a PhD, and you don't specialize in the development of languages. You've never even used flex or bison, ferchissakes.

Name: Anonymous 2006-04-26 21:25

>>17

What's this about developing languages anyway?  I want to write an interpreter for an existing language.  I said:

I want to write my own (scripting language interpreter),
not
I want to write (my own scripting language) interpreter

Get the difference?

Who cares if I have to write code libraries.  Big fucking deal, that's the easy part.  I can probably write my own complete library for a miniature LISP dialect if I wanted to.  All I want to know is where and how to get started on the hard part.

Name: Anonymous 2006-04-26 21:27

>>10

I used JFlex along with CUP once. It wasn't a nice experience. I can't imagine Flex and Bison/Yacc being more rewarding.

Note that in Haskell an interpretor for a simple language (once it's been parsed with the help of BNFC) with variable assignment, if-then-else, while loops and boolean/arithmetic expressions takes not much more than a single screenful of code. There are plenty of reasons /not/ to use Haskell, admittedly. I'm not saying you should.

Name: Anonymous 2006-04-26 21:47

Who cares if I have to write code libraries.

I wouldn't be flaming you so much if you were developing this as an ends. But since it's apparently a part of a larger project, it isn't an ends, it's a means to an and.

Instead of taking what's already there, you're reinventing the wheel. I've seen too many projects get bogged down because they lost sight of their original purpose. It happens all the time, even with professionals.

In fact, I'm guilty of this myself. I'd start of writing games, and end up with decent graphics and scripting libraries, but no games. Thing is, I figured out what I was doing wrong when I was 16, and finally started finishing the things I set out to do.

You've already graduated though, man. Time to smell the coffee.

Name: Anonymous 2006-04-27 2:50

There is no hard part.
1 - read line
2 - use strtok to iterate through lines, and search for keywords
3 - when keyword is found, use strtok more to get parameters for keywords if keyword needs them
4 - search for keyword in an array and convert it to a function pointer
5 - call function pointer with keyword's parameters as arguments
6 - repeat

Name: Anonymous 2006-04-27 3:18 (sage)

>>21
That wouldn't be slow at all!

Name: Anonymous 2006-04-27 14:27

>>21
Appropriate data-structures motherfucker. Do you use it?

Name: Anonymous 2010-06-07 6:37

Hi, I can spam /prog/ too, you faggot.

Also, smoke weed everyday.

Name: Anonymous 2010-09-07 23:44

EN(terpri)SE

Name: Anonymous 2010-09-07 23:45

EN(terpri)SE

Name: Anonymous 2010-12-10 4:18

Name: Anonymous 2011-02-03 1:18

Name: Anonymous 2013-07-07 11:19

Ch : The easiest tool for begineers to learn C/C++ and computing. The fastest way for professionals to write and deploy embeddable C/C++ scripting across platforms : http://www.softintegration.com

Name: Anonymous 2013-07-07 11:20


Don't change these.
Name: Email:
Entire Thread Thread List