Home > Software engineering >  !!!!!!!!! The interpreter code for similar vbscript syntax
!!!!!!!!! The interpreter code for similar vbscript syntax

Time:09-25

Note, not that kind of hundreds of lines, explain the expressions and simple statements, is approximate VBS function, at least can full support to the function and so on, if you have a class is better, so I good transplant to kind of android using the WINDOWS environment,
Thank you very much:)

CodePudding user response:


Why this idea...

CodePudding user response:

Meaningful, of course, I also yesterday caocao summed up several levels of demand

Compilation principle and interpretation class application envisaged:

Star: code formatting,

Two-star:
Syntax highlighting, if can identify variables defined position, plus

Three-star:
Advanced calculator (at least can define multiple variables, define and call a function,)

4:
Code translator (translation between different languages, this will certainly have some limitations, especially some very special written language)

Five-star:
Complete the compiler or interpreter (JIT)

CodePudding user response:

Open source, Basic interpreter and a lot of, to making or sourceforge find,

What you call a few "star", actually is the compilation process of several stages:
Syntax highlighting belong to lexical analysis
Code formatting belongs to syntax analysis (don't know why you put it in front of the syntax highlighting)
The code translation belongs to intermediate code generation (abstract syntax tree structure, AST)
Compiler, JIT belong to code optimization and target code generation
Senior advanced calculator doesn't know how, but generally as a simple code interpreter

CodePudding user response:

According to your request, I found a similar function, easy moderate source code
http://www.codeproject.com/Articles/8924/A-simple-hand-coded-script-parser
Just enough to support the basic data types, structural control and function call

But it is C - Like (I think) between C - Like and Basic - Like

CodePudding user response:

reference 4 floor caozhy response:
according to your request, I found a similar function, moderate difficulty source code
http://www.codeproject.com/Articles/8924/A-simple-hand-coded-script-parser
Just enough to support the basic data types, structural control and function call

But it is C - Like (I think) between C - Like and Basic - Like


Saw that, this certainly does not apply, the website also to find out where my natural, but can't read, Posting here, also because the glasses is very natural, who have seen a suitable,
Actually before others in the BBS said he himself made similar script interpreter, but no later,

CodePudding user response:

reference 5 floor bcrun reply:
Quote: refer to 4th floor caozhy response:

According to your request, I found a similar function, easy moderate source code
http://www.codeproject.com/Articles/8924/A-simple-hand-coded-script-parser
Just enough to support the basic data types, structural control and function call

But it is C - Like (I think) between C - Like and Basic - Like


Saw that, this certainly does not apply, the website also to find out where my natural, but can't read, Posting here, also because the glasses is very natural, who have seen a suitable,
Actually before others in the BBS said he himself made similar script interpreter, but no later,


Ha ha, I learn my college compilation principle has written a similar to this, and it took a week's time, but it can't find my code now, under the online I saw, as he gave, the function of difficulty should be and I had to write about, so I recommend to you,

Don't know why you can't read, the interpreter is actually the main DFA/with a decline in the NFA do lexical analysis and recursive grammar analyzer, if you just modify the lexical, directly in the code to find it a tuo branch switch to your own to go,

CodePudding user response:

CodePudding user response:

refer to 6th floor caozhy response:
ha ha, I learn my college compilation principle has written a similar to this, and it took a week's time, but it can't find my code now, under the online I saw, as he gave, the function of difficulty should be and I had to write about, so I recommend to you,

Don't know why you can't read,


Can read I said refers to the web site search parser and interpreter keyword, this kind of thought is hundreds of results, to traverse a hard all,
You that, I'm still collection, after all the code is shorter, can take out a suitable time to carefully look at, but he notes could see several shortcomings, I think change is not easy:
1, there is no type string, to a character array char [] so, want to add the string I'm afraid is not easy,
2, the called function statements should only directly assigned to variables, and can't be a=fun1 (33) + b such expression, too weird
As for some use (brackets, his use is {, also weird enough, hope this can be as expected, the parser code change,

Ha ha, I think, first look at the TypeScript, ProcessingJs such other grammar translation into the js code is very not easy to understand, after all can run js environment more some, such as the client web pages:)

ha ha, a lot of basic line interpreter can only use basic, don't even support functions, such as the http://www.codeproject.com/Articles/5202/MyBasic-A-Custom-BASIC-language-interpreter-writte

CodePudding user response:

Refer to the Lua source code?

CodePudding user response:

Download a ruby, the author is said to have invented the 1000 languages, only the most watchful eye, the ruby has got a wide range of promotion, ruby itself is open source, you can read it,

CodePudding user response:

references 9 f zhao4zhong1 response:
Lua reference source code?

Sweat a

, there is no reply this post set-top, depressed...

CodePudding user response:

Today on sourceforge search to a new Basic interpreter, downloaded a look carefully, line supports only Basic, is up to the GOSUB, RETURN jump this syntax

The Open Basic interpreter for embedding
http://sourceforge.net/projects/obasic/? Source=directory

CodePudding user response:

TinyC?

CodePudding user response:

This really is not easy...

I have written a compiler before + IDE, is used for a custom a PLC, syntax similar to assembly, support simple memory management, realize the basic function such as process control, already feel quite laborious.

Main frame is also good, mainly is all sorts of details, such as lexical analysis of fault tolerance, automatic formatting, parameter identification and so on, to make a product that is not the average person can do good.

For now I am considering to look for a good others have written a whole set of mature, they haven't got the good ability to the whole the whole

CodePudding user response:

And look bcrun said also is similar to the kind of request, I need most of the details are perfect, difficult.

Yourself have done a lot of things after just understand, the real test level is the last 20%... The front 80% almost a lot of people can do it.

Think about how many people around the world have written the basic operating system, but not much can be successfully developed, should be the law of 8020.
So bcrun if you find the right, please also let me know, I also want to

CodePudding user response:

reference 14 floor myjian reply:
till now I am thinking of looking for a good others have written a whole set of mature, they haven't got the good ability to the whole the whole

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related