26.9.2011 0:26, BGB kirjoitti:
Did you ever consider JavaScript? There should be several engines
available, and it loads of couse from source files, and has eval.
my language (BGBScript) is largely initially based on JavaScript (I
initially ran across JavaScript, and mostly threw together "something
similar").
at the time (around late 2003), I was not aware of there being any
freely available/standalone JS engines, and I had just assumed write my
own. continued maintenance/expansion has generally been "the path of
least effort".
my language also takes a lot from ActionScript and C# (and C), and
mostly conforms with ECMA-262 (ECMAScript). main areas of
difference/non-conformance are mostly related to scoping semantics,
minor language semantics/features, extensions, and differences regarding
the treatment of numeric types (a numeric tower exists).
it is "hit or miss" as to whether or not numeric types are auto-promoted
(manual promotion is preferable). implicit down-promotion will work but
result in truncation (like in C or C++). eventually, this may be made a
warning (the compiler may warn if implicit conversions will lose
precision, but will not likely require explicit down-casts).
technically, the language also (sort of) supports pointers and
value-types and similar as well. the language supports "structs" which
are essentially pass-by-value classes with C#-like semantics (I may
later define a "proper" pass-by-value class type, which could
essentially also be used for doing something analogous to the C++ RAII
concept). I am currently leaning towards a name something like "byval
class" or "value class".
pointers are "not often used", and intended mostly to ease C
interfacing, and may be allowed/disallowed based on "access rights".
before, I had written a C compiler, and later implemented a customized
JVM, mostly as:
initially, I figured I could use C for scripting (vs an earlier form of
BGBScript), which would give good performance and C plays nicely with C.
however, compiler performance and bugs mostly killed this effort (making
a C compiler both fast and reasonably solid is non-trivial).
(for a scripting language, and loading-from-source, it matters somewhat
that the compiler is fast, and standard C didn't really allow for this).
I later implemented a customized JVM, but it (and Java in general) just
didn't really "fit" with what I wanted to do with it in this case, which
killed this effort (a standard JVM would have posed similar issues, the
customized VM was mostly so that I could "fix" the problems with the
main VM, but found that many were architectural and there often was no
real "fix"). also, my own implementation would have been "bastardized"
with many extensions.
I then tried to design a "new" language and VM at this point (the new
language would have been more Java-like), but this effort went nowhere
(mostly for sake of me starting to realize the effort investment required).
so, eventually I resumed continued use/maintenance of my existing
language and VM (and most of the imagined features for the new language
and VM were later bolted/kludged onto the old language/VM instead).
it currently supports both JavaScript/ActionScript style declaration
syntax, as well as Java/C# style syntax, but JS/AS syntax is more in the
direction I am leaning for the "proper" declaration syntax, but who knows.
or such...