473,383 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

about gmac script language

Hi All!

I have been developing an embedded macro script language (called gmac) for some time, and I would like to ask your opinion about it.

Here is a quote from the introduction part (in the readme):

Gmac is more like an embedded script language (like JavaScript), than a
common macro preprocessor. You can execute small scripts enclosed in '[;'
and ']'. These scripts are executed by gmac. Other parts of the input
are left unchanged. Well, this is not entirely true, since some commands
can further read the input. (These read commands can help you to write
your own custom preprocessor)

Short feature list:
- C style script language (at least not far from that)
- simple types: int, float, string, array, object
- type-less variables (conversions are checked run-time)
- object oriented (classes and virtual methods are supported)
- function context save (these saved contexts are called frames)
- built in error handling (try blocks)
- small memory footprint (useful for embedded systems)

You can download it from:
http://sourceforge.net/project/showfiles.php?group_id=160876

Areas where it may be useful:
* Many programs has limited parsing abilities. Gmac can push these limits, and, in the same time, you can put your code where it will be used, not in several hard-to-find scripts.

My qestions:
* Do you think the overall direction of this project is good? Or are there better tools? Do not hesitate to tell me, I want to learn :)

* Are there any good websites, where such new tools can be discussed? I am not sure this is the right place (I mean, this is a "Misc Qestions" category, but gmac seems not really fit in other categories as well).
Aug 16 '08 #1
14 1663
joedeene
583 512MB
i think this an appropriate spot for this thread, the only other possible threads it could go under, POSSIBLY, are software development, or maybe the programming language you used to make this program, but i think this is an appropriate thread, and as far as is the overall direction of the program is good, well i havent used it so i cant compare and judge but i think it can always be a good thing to have a commited programmer trying to make something new, thats beneficial, so i mean as long as you dont have virus' in your program, then it is heading in a good direction with your commitment to keep at it, keep fixing bugs, make it more advanced and just the experience gained can be benefical to in the end, *This is my opinion*
Aug 16 '08 #2
JosAH
11,448 Expert 8TB
Can gmac be used as an embedded script engine for compiled languages as well?
(e.g. C, C++ etc.)
Do we need an extra preprocessing phase then? On the side: what has gmac
to offer that other languages don't offer?

kind regards,

Jos

ps. Just curious but your link didn't work for me (my WiFi has hiccups)
Aug 17 '08 #3
Thank you for your encouragement! This is the third major revision of this project (I don't like the syntax of the first one, the second one was too slow. This version is partially inspired by the JavaScriptCore subproject of Apple's WebKit)

It was strange this link was not work:
http://sourceforge.net/project/showfiles.php?group_id=160876

This is an outdated old site of this project, but the "download" link still works: http://gmac.sourceforge.net/

You can also find it, if you search the word "gmac" in the sourceforge portal. (And google also can find it sometimes, however, not always the most recent version...)

JosAH, your guess is right. An extra preprocessor phase is needed, if the library is not included by the other tool (the main.c shows how you can extend any existing tool with gmac, it is practically a getc, putc pair).

You can extend anything with gmac (even C, C++), but perhaps, it is better for non-procedural languages, since they have more limitations. I worked with a program, which uses .ini configuration files, and it does not offer any kind of expression evaluation. Gmac was great help there.

However, ther are some things I used gmac and C before:

* Directories are separated by backslash under Windows and slash under Linux. This can be automatically done during preprocessor phase.

* I made a game, and the game uses "items". These "items" are constant objects, with several properties. With gmac, I can describe them in object level, and it made several define constants and arrays from those objects. It is much easier to maintain high level structures.
Aug 17 '08 #4
JosAH
11,448 Expert 8TB
I'll check out that link again because Google only gave me General Motor stuff,
mortgage schemes named gmac and some mysterious genetic modification
house of horror somewhere in Asia ;-)

As a premature question: how's the language interaction between a language X
and gmac? Can X use gmac's objects/values and/or vice versa? How fast is it?
Does that link contain a user guide or some language definition text?

kind regards,

Jos
Aug 17 '08 #5
Perhaps google don't think much about this project :) I must admit, although this project is two years old, it has not gained too much attention so far.

- interaction: There is no interaction now. But that is a very good idea! Well, I don't know about other languages internal working, but with a little help, I think I can implement some nice things.

- speed: I think it is two times slower than the mentioned JavaScriptCore engine. For me, a highly configurable engine, and working without memory leaks are more important that the raw speed at the current development stage.

Currently you can configure:
* character type (char, wchar_t)
* integer type (int, long int, long long int, __int64, etc)
* float type (can be disabled) (float, double, long double)
* win32, linux32, linux64 are ok, except some issues with floating point - integer conversion things, which seems dependent on the compiler not the OS.

- docs: the zip file contains a 26 kbyte README file, all source codes, binaries for linux and windows.
Aug 17 '08 #6
Curtis Rutland
3,256 Expert 2GB
Well, as Jos mentioned, GMAC is General Motor's financing company. Don't ever expect to get top google hits :p
Aug 17 '08 #7
JosAH
11,448 Expert 8TB
Maybe it would be fun to see how fast gmac is on this recursive benchmark.
It's just three functions: Ackermann, Fibonacci and Tak; they're completely
useless of course but are real speed killers for (more or less) functional programming
language interpreters.

My own toy language can only perform the tests fast when I enable memoization
but others consider that cheating ;-)

If you can compare it to the C version on your computer we can see a speed ratio.

kind regards,

Jos
Aug 20 '08 #8
Hi Jos!

That page is interesting! I haven't heard about it before.

The results for N = 11 (user time):

C: 0m1.508s - 1,5 sec (using the implementation provided by that site)
GMAC: 5m59.182s - 359.182 sec -> 239.3 times slower

2.36 * 239.3 --> probably 564.82 sec on their measurement system.

The speed is around the other interpreted languages. I plan speed optimizations later, but that is not my focus now. (I made coverage tests with gprof and gcov, and it seems the id resolving should be faster)
Aug 20 '08 #9
JosAH
11,448 Expert 8TB
The results for N = 11 (user time):

C: 0m1.508s - 1,5 sec (using the implementation provided by that site)
GMAC: 5m59.182s - 359.182 sec -> 239.3 times slower

2.36 * 239.3 --> probably 564.82 sec on their measurement system.
According to the table in that link your language has about the speed of Python,
which is reasonable. I read your readme file but I couldn't figure out whether you
do dynamic binding or lexical binding. The former is more fun (and quite a bit
older than lexical binding) but quite a bit slower when deep recursion is involved.

kind regards,

Jos

ps. my toy language uses deep binding which is slow as molasses when that
memoization feature is turned off ;-)
Aug 20 '08 #10
Dynamic binding. I agree, dynamic binding is far more fun :)

That means this code is ok:
Expand|Select|Wrap|Line Numbers
  1. [;
  2.   func = sub() {
  3.     func2()
  4.   }
  5.  
  6.   func2 = sub() {
  7.   }
  8.  
  9.   func()
  10. ]
  11.  
Well, gmac is focuses on stream parsing, which usually not involves deep recursion. Instead, many string fragments are passed through a pipeline (with in and out operators). This is the preferred way instead of making large strings with += . To tell you the truth, gmac is not wanted to be another pyton, javascript, C, or any common procedural or object oriented language. It is more like a 'sed' or 'awk' in its unique way, bit its approach is quite different.

Can I have a question? What is molasses? :) Wikipedia says it is a thick syrup.

(I will be away for 2 days, but after that I hope we can continue this discusson. I have learnt much from you. Thanks)
Aug 20 '08 #11
Curtis Rutland
3,256 Expert 2GB
Molasses is a thick syrup. It pours quite slowly, more so when it is cold. Hence the common expression: "as slow as molasses in January." I'm not sure how many languages/cultures that expression spans though.
Aug 20 '08 #12
JosAH
11,448 Expert 8TB
Can I have a question? What is molasses? :) Wikipedia says it is a thick syrup.

(I will be away for 2 days, but after that I hope we can continue this discusson. I have learnt much from you. Thanks)
There is a (slang) Dutch saying that goes "it's as slow as thick horse sh*t through
a physician's funnel". I hope that explains it ;-)

I don't understand the deep binding from your gmac example but I think that's
just me. Maybe a few paragraphs in your readme fille that would explain your
gmac's paradigm a bit more would go well with it.

And I think a bit of a language binding would go well with the popularity of your
gmac language.

kind regards,

Jos
Aug 20 '08 #13
Hi!

I made some performance optimizations in gmac. Now, the local variable references are stored in an array, so they can be accessed very fast, and some functions are changed to inline. Those changes greatly improve the md5 calculation benhmark (down to 101 msec from 126 msec), and slightly improve the recursive benchmark (5 min 43 sec from 5 min 59 sec).

Do you have any general ideas (experiences) which makes interpreted, non-typed, stack-based languages fast? (Except JIT or tracing :) ) Now, a high level byte-code is generated from the abstract syntax tree. That byte-code is interpreted by the main loop.

Thanks in advance.
Aug 31 '08 #14
JosAH
11,448 Expert 8TB
Well, memoization is great for speed (but uses quite a bit of memory); it can only
be used for referential transparent functions (i.e. f(x) always returns the same
value for the same x and has no side effects). Keep a table of f(x1), f(x2) ... f(xn)
and when f(x) is called with a known x, simply retrieve the function value from that
table because there is no need anymore to call the actual function. When x isn't
known yet in the table, call f(x) and register its return value when f returns.

kind regards,

Jos
Aug 31 '08 #15

Sign in to post your reply or Sign up for a free account.

Similar topics

28
by: David MacQuigg | last post by:
I'm concerned that with all the focus on obj$func binding, &closures, and other not-so-pretty details of Prothon, that we are missing what is really good - the simplification of classes. There are...
10
by: George Hester | last post by:
Any ideas how to decipher it? <script language = "JavaScript"> var x =...
1
by: bayouprophet | last post by:
Cant get menu script to to put linked page in the same frame. I am new to Java and I am wondering what am I doing wrong? below are my java applet file, frame.html file, and my text file and one...
1
by: Allen | last post by:
I am trying to add an additional photo/hyperlink to the company web site (I didn't create it) without any luck. The mouseover feature 'highlights' pics by swapping them with another pic using this...
3
by: Ricardo Garcia | last post by:
hi, i was just wondering about javascript version i used to do it putting in the <head>: <script type="text/javascript"> jsver = "1.0"; </script> <script language="JavaScript1.1"> jsver =...
6
by: Steve B. | last post by:
Hello everybody In a webpage, I use JS display data from an xml file and a xsl file: var data = new ActiveXObject("Microsoft.XMLDOM"); data.async = false; var dataUrl = "data.aspx";...
0
by: dark100 | last post by:
Hi All ! I have started to develop a general preprocessor called gmac. You can use it for generating context sensitive configurations, static html pages with dynamic elements, ... Something like...
19
by: thisis | last post by:
Hi All, i have this.asp page: <script type="text/vbscript"> Function myFunc(val1ok, val2ok) ' do something ok myFunc = " return something ok" End Function </script>
22
by: Sandman | last post by:
So, I have this content management system I've developed myself. The system has a solid community part where members can register and then participate in forums, write weblogs and a ton of other...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.