⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme.txt

📁 示范利用 Delphi 制作 BASIC 程序语言解释器
💻 TXT
字号:
Well, many people have proboably some time thinked about creating a own
programming language. I've started to model on maybe 5 different ones,
but i started in the wrong end of the project, so it taked a day or
two and I gave up.

However, a time ago, I really created a own language. I call it BWA64KL
(Bells, Whisles and 64K Limits). So now I know how to make languages,
and I want to spread my ideas abit. MBASIC.DPR is the first step in
the creation of an interpreter. I'll proboably continue with the second
finalizing step, but not today...

The key to, and first step of, a compiler or interpreter is the code
massager. If it's a interpreter we're doing, we should design the
code so we're loading it into memory, massaging it and then running
the application.

It's a basic i've started with, so I've designed my massager after
it. My massager does this:
	* Removes leading and ending spaces and tabs (and trash).
	* Makes constants of inline strings
	* Uppercases the source

With this massager as a good start, it'd just take me a day or two
to complete the interpreter. I mean, what code do you prefer to
interpret 1. or 2.?

1.
Constants;
	(no massaged constants)
Source:
sub maina 'comment
	msgbox "inline string"
end sub

2.
Constants:
	INSTR_00000000
Source:
SUB MAINA
MSGBOX INSTR_00000000
END SUB

1. would be slow and hard to interpret. It really smells microsoft about
it. But 2. is much MUCH easier to interpret - we know SUB is in
uppercase, so when scanning for sub main it's just to look after a string
with the first word SUB and next one MAIN. There it is..

Enjoy, Mike..

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -