I have recently update M2000 Interpreter to version 9. Code is open source, written in VB6.
Also there are some Wiki pages on github about M2000
https://github.com/M2000Interpreter/...ction-to-M2000
Printable View
I have recently update M2000 Interpreter to version 9. Code is open source, written in VB6.
Also there are some Wiki pages on github about M2000
https://github.com/M2000Interpreter/...ction-to-M2000
I am writing the Wiki. (help because my English are very bad..)
https://github.com/M2000Interpreter/Version9/wiki
A BlackJack for 4 players (we can alter player number for 1 to any number) and a dealer (played by computer).
With Split and Doubling Down functions
https://github.com/M2000Interpreter/...-in-M2000-code
or with colored code
http://georgekarras.blogspot.gr/2017...2000-code.html
An notepad created in M2000 (an Interpreter written in VB6)
Has a lot of comments and Images.
http://georgekarras.blogspot.gr/2018...3-version.html
New topic in rosettacode.org
http://rosettacode.org/wiki/Category:M2000_Interpreter
265 tasks in rosettacode.org
100 doors
2048
A+B
ABC Problem
Abstract type
Accumulator factory
Ackermann function
Add a variable to a class instance at runtime
Animate a pendulum
Animation
Anonymous recursion
Apply a callback to an array
Arithmetic evaluation
Arithmetic-geometric mean
Arithmetic/Integer
Arithmetic/Rational
Array concatenation
Array length
Arrays
Aspect Oriented Programming
Assertions
Associative array/Creation
Associative array/Iteration
Averages/Mode
Averages/Pythagorean means
Babbage problem
Banker's algorithm
Binary digits
Bitmap
Bitmap/Read a PPM file
Bitmap/Write a PPM file
Boolean values
Box the compass
Break OO privacy
Caesar cipher
Calculating the value of e
Calendar
Calendar - for "REAL" programmers
Call a foreign-language function
Call a function
Call an object method
Case-sensitivity of identifiers
Catalan numbers/Pascal's triangle
Catamorphism
Character codes
Check that file exists
Classes
Closures/Value capture
Collections
Color of a screen pixel
Colour bars/Display
Combinations
Combinations and permutations
Comma quibbling
Comments
Compare a list of strings
Concurrent computing
Conditional structures
Count the coins
CRC-32
Create a file
Create a two-dimensional array at runtime
Create an object at a given address
Create an object/Native demonstration
CSV data manipulation
Currency
Currying
Date format
Day of the week
Define a primitive data type
Delegates
Determine if a string is numeric
Dot product
Doubly-linked list/Definition
Draw a pixel
Dynamic variable names
Empty program
Empty string
Enumerations
Environment variables
Even or odd
Exceptions
Extend your language
Extensible prime generator
Factorial
FASTA format
Fibonacci sequence
File input/output
Filter
Find limit of recursion
First-class functions
First-class functions/Use numbers analogously
FizzBuzz
Formatted numeric output
Forward difference
Function composition
Function definition
Function prototype
Gamma function
Gaussian elimination
Generate lower case ASCII alphabet
Generator/Exponential
Generic swap
Get system command output
Gray code
Greatest common divisor
Greatest element of a list
Guess the number
GUI component interaction
GUI enabling/disabling of controls
GUI/Maximum window dimensions
Hailstone sequence
Happy numbers
Hash from two arrays
Hash join
Hello world/Graphical
Hello world/Line printer
Hello world/Newbie
Hello world/Text
Here document
Higher-order functions
History variables
Hostname
HTTP
Huffman coding
Hunt The Wumpus
IBAN
Include a file
Increment a numerical string
Inheritance/Multiple
Inheritance/Single
Input loop
Integer overflow
Interactive programming
Inverted syntax
Jensen's Device
JSON
Jump anywhere
Keyboard input/Flush the keyboard buffer
Keyboard input/Obtain a Y or N response
Keyboard macros
Knapsack problem/Continuous
Knuth shuffle
Literals/Floating point
Literals/Integer
Literals/String
Logical operations
Loops/Break
Loops/Continue
Loops/Do-while
Loops/Downward for
Loops/For
Loops/For with a specified step
Loops/Foreach
Loops/Increment loop index within loop body
Loops/Infinite
Loops/N plus one half
Loops/Nested
Loops/While
LZW compression
M2000 Interpreter Json Class
M2000 Interpreter rational numbers
Machine code
Magic 8-Ball
Mandelbrot set
Memory allocation
Metaprogramming
Monty Hall problem
Move-to-front algorithm
Multiple distinct objects
Multiplication tables
Multisplit
Munchausen numbers
Musical scale
Mutex
Mutual recursion
N-queens problem
Named parameters
Naming conventions
Nested function
Nonoblock
Nth root
Null object
Number reversal game
Odd word problem
OLE Automation
Perfect numbers
Permutation test
Permutations
Permutations with repetitions
Pi
Pig the dice game
Pig the dice game/Player
Playing cards
Pointers and references
Polymorphism
Primality by trial division
Prime decomposition
Priority queue
Quaternion type
Queue/Definition
Random numbers
Read a file character by character/UTF8
Read a file line by line
Read entire file
Real constants and functions
Reduced row echelon form
Regular expressions
Rename a file
Reverse a string
Rosetta Code/Rank languages by popularity
Runtime evaluation
Scope modifiers
Search a list
Secure temporary file
Sieve of Eratosthenes
Simple windowed application
Sleep
Smith numbers
Solve the no connection puzzle
Sort a list of object identifiers
Sort an array of composite structures
Sort numbers lexicographically
Sort stability
Sort three variables
Sort using a custom comparator
Sorting algorithms/Bubble sort
Sorting algorithms/Quicksort
Sorting algorithms/Shell sort
Speech synthesis
Spinning rod animation/Text
Split a character string based on change of character
Stack
String append
String concatenation
String interpolation (included)
String length
String matching
String prepend
Substring
Sum of squares
System time
Table creation
Terminal control/Preserve screen
Terminal control/Ringing the terminal bell
Terminal control/Unicode output
Text processing/Max licenses in use
The Name Game
Tic-tac-toe
Time a function
Top rank per group
Towers of Hanoi
Trabb Pardo–Knuth algorithm
User input/Graphical
User input/Text
Using a Speech engine to highlight words
UTF-8 encode and decode
Variables
Variadic function
Vector products
Walk a directory/Non-recursively
Window creation
Word wrap
Y combinator
Zero to the zero power
The M2000 Interpreter and Environment has finished as a VB 6 open source project.
Here is a paper for the language M2000.
https://github.com/M2000Interpreter/...M2000paper.pdf
Aim of M2000 is the educational branch, as a tool for pupils and for teacher to make some applications to support their course.
vb6 projects belong in the Visual Basic 6 and Earlier Forum.
EDIT:
After looking at the code samples at Rosetta and in the manual I tried to create and load file but there appears to be no obvious way to load code saved in a file. Can your program load code from external files? And if so, how?
Peter, the reason the thread is here is because the "M2000 Interpreter" is an "other BASIC" language, which just happens to be written in VB6.
I think that may be answered on page 124 of the manual. https://github.com/M2000Interpreter/...M2000paper.pdf
Well, I've never looked into it myself.
But since is it open source, you could try running the program in the IDE and see where it is crashing.
Or, if you really don't have the time and/or interest, I guess wait to see if George will respond. Since he was on earlier today with the update to this thread, perhaps he'll be back soon.
I've see the topic various times over the last several years, but haven't tried any version of it myself. From what I've seen of it on the forum, I'm not sure that I agree with the proposition that this interpreter is better suited for teaching students a programming language compared to VB6.
The M2000 interpreter, just from what I've see of it, didn't seem to be easier to comprehend compared to VB6, or other BASICs.Quote:
"... Then he found that Visual Basic is a fantastic environment but not for pupils."
And if you have problems getting it to run, then that doesn't bode well either.
But, since I haven't actually tried it, my minimal observations shouldn't be given much merit.
I guess what you do now depends on how interested you are in exploring someone's project.
You can hit the || pause button, then click on the debug "step over" button to see where in the code you are, or what the next periodic event that occurs.
You can step through the code to see if you understand what it is doing at that point, and why it might not be showing the M2000 console.
I presume the M2000 console is just a VB6 Form, but have no idea.
Sometimes, if a program is truly new to me, I may just hit the "Step Into" button at the start, rather than the "Run" button, or F5 key so that I can see what the program is doing from the very start.
Perhaps there is some error that is hidden by an OnError statement, so you are just stuck in a loop, repeating the error without handling it, so there is no indication of a fault and you can't progress.
1. Well, I am interested in taking a look; I will see where it goes from there.
2. Does not appear to be working, no code is highlighted when I pause the program.
3. Stepping doesn't appear to be enabled for this particular project.
4. I can't prove or disprove your presumption, there are several forms but none look like the interface displayed while the compiled program was running.
5. Clicking "Step into" or pressing "F5" don't work. The program appears to compile and run; but visible is happening.
6. Disabling 897 error traps worked. Now we're getting somewhere. It now says "Sub or function not defined.". Presumably an external component.
Thank you for replying. I will get back to this thread when I have found out more.
Some investigation told me the following:
1. There is a project group file called "testme.vbg" which can't be loaded from Explorer because Microsoft Visual Basic 6.0 Enterprise will not load it properly. It gets mistaken for a module.
2. When I load the "testme.vbg" file via the "Open Project" menu option Visual Basic throws an error about an invalid key called "StartUpProject", after that an error claiming "VBGROUP 5.0" appears.
3. While I appear unable to reproduce the situation, a dialog stating the project ("m2000.vbg") was made in an earlier version of Visual Basic appeared once or twice.
EDIT:
4. There are several batch files referring to Micosoft Macro Assembler, as near as I can tell the executable needs to be modified after having been compiled with Visual Basic.
EDIT 2:
5. I now noticed the manual has been downloaded as well. Going to have a closer look.
EDIT 3:
6. The manual explains how to use the software, not how to properly compile it or how to set it up...
EDIT 4:
7. There is a readme file with links to a few binaries, some code and the manual. The other text files are a log (only reads: "Line 17: Cannot load control gList2."), the other mentions a *.cab file which I don't appear to have has been built. The other file appears to be a numbered list in both greek and english. BTW: The readme mentions a certificate (ca.crt) that I could install... BTW 2: These binaries turned out to be an M2000 installer and a copy of ca.crt.
It looks like I have made a breakthrough:
I can now load and execute programs:
https://drive.google.com/file/d/1cZ0...ew?usp=sharing
The above url links to an animated gif of a few seconds.
And thank you for setting me on the right track Passel!
I'm not really sure what I did, other than the minor pointing out of a page in the manual.:bigyello:
I'm pretty sure I would have stopped after step 5 in post #16 if it were me.
List of M2000 examples in OOP
Creational Patterns
SingletonPattern
FactoryMethod Pattern
FactoryPattern
AbstractFactory Pattern
BuilderPattern
PrototypePattern
PoolPattern
Behavioral Patterns
MementoPattern
MediatorPattern
ObserverPattern
NullObject Pattern
VisitorPattern
InterpreterPattern
IteratorPattern
StrategyPattern
CommandPattern
StatePattern
TemplateMethod Pattern
Chainof Responsibility Pattern
StructuralPatterns
AdapterPattern
BridgePattern
CompositePattern
DecoratorPattern
FlyweightPattern
FacadePattern
ProxyPattern
Hello Peter Swinkels
You can run from IDE if you want but you have to do some things:
First because M2000 has Greek and English identifiers, you have to choose a greek font from VB6. IDE.
The M2000.vbp make the Μ2000.dll. So you have to start it from Vb6 and then you have to start the m2000.exe, which execute it. I have edit many times code when the dll running from iDE. You can use threads and windows from ide too.
Please get the revision 46 of version 9.9
You can unistall the language as all programs and then install new again. All binaries are signed by me. The last few also have signed the uninstall exe too.
Load "alfa.gsb" just open a file to editor, not loaded as program.
Load name is the proper command
Peter Swinkels
Read this (and if you know better english than me, correct it please.
https://github.com/M2000Interpreter/Version9/wiki
M2000 has GNU GPL 3 licence
Maybe you can make the Dutch Version, replacing Greek Identifiers and keep the English. There are more than 500 identifiers for each vocabulary.
Hello GeorgeKar,
I am not going to be able to proof-read an entire wiki for you, nor am I going to translate an entire project into another language. What I can do is help you with grammar and give advice regarding translations. I attached a corrected version of you Wiki's front page text with corrections in red. You need to pay more attention to how you use the definite article and verb tenses.
yours,
Peter Swinkels
Thank you very much
Enjoy the M2000 language.
There are plenty of programs in info.gsb file.
if you want to export code from internal editor and you have tabs, then it is better to change automatic to spaces.
Use Switches "-nbs" in M2000 console, to enable the automatic change
Use Help Switches to see about command. Switches can be passed to command line when you open m2000 environment.
Peter Swinkels,
Don't miss the last revision 48. Also I change a bit the M2000paper.pdf.
Peter,
Do you run the programs in info.gsb? The biggest is a chess (without AI, just for two players) using FEN strings for storing previous positions. At the end you can export these strings and pick one to start from that point or in the game you can go back to some earlier point.
Revision 49 is the best one for now.
For any reader,
M2000 has not the strength of a production language. From a point of view the environment of the language recreate a micro from '80s, using user GUI, OOP, Lambda functions, massive memory, graphics, sound, speech, score playing through midi, threads as part of the language, event programming, using of external com objects with events, using of external functions in dll, by C or StdCall calling convention. Also you can use/make databases and handling printers too.
Some languages change in time, making obsolete things. M2000 ban the obsolete mechanism. You write a program, today and has to run twenty years later. For this reason and the benefits from VB6 like the compiling directive to exclude arrays bound checking (like c), M2000 use VB6. The core dll of VB6 as I know is a part of Windows 10. So if Windows 10 is the last operating system from Microsoft, then Vb6 core dll would exist decades from today.
M2000 has two sets of identifiers, from English and Greek languages. Scope of the double set is to be later change one,say the Greek, to another language. Also the help system works for both languages so for a new language we have to provide help text for each identifier. It's important for me a pupil to programming using identifiers from his or her language.
George Karras
It's graphical, and you can move the pieces or write simple e2e4 + enter to move it.
Load Info
Then press F12 to start chess. You can pick a FEN string and start chess with that string to open chess with the pieces according to FEN
https://en.wikipedia.org/wiki/Forsyt...wards_Notation
Peter,
Also check the BJ (black jack) and Pong (a kind of Pong game for one player)
Intentionally isn't user friendly. As I remember, neither a Texas TI99/4A, from a friend, was user friendly nor the Acorn Electron I owned in the year 1984 was user friendly. Always with the manual at hand, and some magazines from I had to write on it, and then if I didn't accidentally push the break button, I had to saved on a tape drive,
So in M2000 if you press break (the pause button) you get a message to ask you if you really want to reset the environment. And that is a bit more of user friendly.
Some tips:
Win Dir$ (open the user directory on explorer)
Keyboard ! (open the virtual keyboard)
Settings (open the settings dialog)
With a new revision the info file may change, so:
Dir Appdir$
Load Info
Then press F1 to save it to user folder
Now if info is loaded then press F8 open the mEditior, a notepad for M2000, in a window, running in M2000. From that open the info file, 25k lines, and you can mark a word and press F3 to search down or F2 to search up. Its very fast editor. This editor use the EditBox a control made in M2000 environment, with programmable syntax color.
There are other editors:
CS for CSharp editor, You can compile the program from that editor and execute it. Its simple, but as all those programs included in a distro, has to be simple. Has syntax color for c sharp.
HtmlEditor Is another one for Html with syntax color too.
I have another for VB6 but not in the Info.gsb which is a collection of programs.
Fkey statement display the functions keys which info made for you.
There three statements which clear a part of internal state:
New clear programs (as modules loaded)
Edit A
write something press Esc to exit
Modules ? (or ctrl + N)
You see A as module
New
Modules ? (or ctrl + N)
You see nothing
Clear clear static variables and global made in console.
A=10
List ' show A=10
Clear
List ' show nothing
Flush empty the stack of values
Check this:
Push 1,2,3 : Stack: Flush : Stack ' now is empty
Also statement start is the software reset.
Don't forget to use END to exit from console
That's not all
George
Using SQLITE3, from M2000 Interpreter:
Need the ODBC Driver 32bit from here http://www.ch-werner.de/sqliteodbc/
https://github.com/M2000Interpreter/Environment/releases/tag/Ver10%3B0Rev8
Code:Print "Wait..."
db.provider ""
a$="DRIVER=SQLite3 ODBC Driver;Database="+dir$+"one.db;LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0;"
db.provider a$, "ODBC", "newpassword"
execute "(sqlite3db)", {
CREATE TABLE customers (
customer_id INTEGER PRIMARY KEY,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL,
birth_date date DEFAULT NULL,
phone VARCHAR(50) DEFAULT NULL,
address VARCHAR(50) NOT NULL,
city VARCHAR(50) NOT NULL,
state char(2) NOT NULL,
points integer NOT NULL DEFAULT 0
);
INSERT INTO `customers` VALUES (1,'Babara','MacCaffrey','1986-03-28','781-932-9754','0 Sage Terrace','Waltham','MA',2273);
INSERT INTO `customers` VALUES (2,'Ines','Brushfield','1986-04-13','804-427-9456','14187 Commercial Trail','Hampton','VA',947);
INSERT INTO `customers` VALUES (3,'Freddi','Boagey','1985-02-07','719-724-7869','251 Springs Junction','Colorado Springs','CO',2967);
INSERT INTO `customers` VALUES (4,'Ambur','Roseburgh','1974-04-14','407-231-8017','30 Arapahoe Terrace','Orlando','FL',457);
INSERT INTO `customers` VALUES (5,'Clemmie','Betchley','1973-11-07',NULL,'5 Spohn Circle','Arlington','TX',3675);
INSERT INTO `customers` VALUES (6,'Elka','Twiddell','1991-09-04','312-480-8498','7 Manley Drive','Chicago','IL',3073);
INSERT INTO `customers` VALUES (7,'Ilene','Dowson','1964-08-30','615-641-4759','50 Lillian Crossing','Nashville','TN',1672);
INSERT INTO `customers` VALUES (8,'Thacher','Naseby','1993-07-17','941-527-3977','538 Mosinee Center','Sarasota','FL',205);
INSERT INTO `customers` VALUES (9,'Romola','Rumgay','1992-05-23','559-181-3744','3520 Ohio Trail','Visalia','CA',1486);
INSERT INTO `customers` VALUES (10,'Levy','Mynett','1969-10-13','','68 Lawn Avenue','Atlanta','GA',796);
}
report "customers created"
report "Selected customers where Points<1000 in descending order"
execute "(sqlite3db)",{
SELECT customer_id,
last_name,
first_name,
phone,
points
FROM `customers`
WHERE Points<1000
ORDER BY Points DESC,
last_name,
first_name
}
Def CheckNull$(a, a$)=If$(type$(a)="Null"->"NULL", a$)
GetListA() ' value is already in stack
report "Select customers id where phone is null"
execute "(sqlite3db)",{
SELECT customer_id,
phone
FROM `customers`
WHERE phone IS Null
ORDER BY customer_id
}
GetIDwithNullPhone() ' value is already in stack
wait 300
close base "(sqlite3db)"
wait 300
if exist(dir$+"one.db")then
dos "del "+dir$+"one.db";
wait 300
end if
sub GetListA(RS)
if type$(RS)="Recordset" then
with RS, "EOF" as new rs.eof, "fields" as new fields(), "fields" as new fields$(), "fields" as new rs.fields
with rs.fields, "count" as new rs.fields.count
print "Test number of fields:", rs.fields.count
while not rs.eof
print $(6),fields(0),
print $(9)," ";fields$(1);" ";fields$(2);@(32); CheckNull$(fields(3), fields$(3));@(42), fields(4)
method rs, "movenext"
end while
print $(0),,
end if
end sub
sub GetIDwithNullPhone(RS)
if type$(RS)="Recordset" then
with RS, "EOF" as new rs.eof, "fields" as new fields(), "fields" as new fields$(), "fields" as new rs.fields
with rs.fields, "count" as new rs.fields.count
print "Test number of fields:", rs.fields.count
while not rs.eof
print $(4), fields(0), $(7), CheckNull$(fields(1), fields$(1)), $(0)
method rs, "movenext"
end while
end if
end sub
https://github.com/M2000Interpreter/...tag/Ver11Rev13
You can find the latest M2000Paper.pdf the english paper about M2000.
Also there is a Greek Manual as GreekManual.pdf.
M2000 Interpreter and environment written in Vb6, with great help from posts from VBForums.
GK
This is a video of Version 12 revision 4 (not uploaded yet, but actual show things that Version 11 can do, except for the new Test form which has error log and the use of Functions keys, plus a run to error capability)
https://www.youtube.com/watch?v=JBJ24tpz4yQ
Version 12, rev7 is very good, and is 99% compatible with previous versions. The differences has to do with unary minus, which now work as in VB6 and the power function for integer, long, long long which not used the VB6 power, but a faster code optimized for integers (also the type preserved or raised an overflow error).
Here is the link from Wiki, at Git Hub "About M2000)":
https://github.com/M2000Interpreter/...nd-Environment