Re: [fonc] deriving a POL from existing code

2013-01-23 Thread BGB

On 1/9/2013 11:53 AM, David Barbour wrote:


On Wed, Jan 9, 2013 at 9:37 AM, John Carlson yottz...@gmail.com 
mailto:yottz...@gmail.com wrote:


I've been collecting references to game POLs on:
http://en.wikipedia.org/wiki/Domain-specific_entertainment_language


That's neat. I'll definitely peruse.



interesting...


my own language may loosely fit in there, being mostly developed in 
conjunction with a 3D engine, and not particularly intended for 
general-purpose programming tasks...


like, beyond just ripping off JS and AS3 and similar, has some amount of 
specialized constructs mostly for 3D game related stuff (like 
vector-math and similar).


well, and some just plain obscure stuff, ...


BTW: recently (mostly over the past few days), I went and wrote a 
simplistic JIT for the thing (I have not otherwise had a working JIT for 
several years).


it turns out if one factors out most of the hard-parts in advance, 
writing a JIT isn't actually all that difficult (*1).


in my case it gave an approx 20x speedup, bringing it from around 60x 
slower than C with (plain C) threaded code, to around 3x slower than C, 
or at least for my selection-sort test and similar... (the recursive 
Fibonacci test is still fairly slow though, at around 240x slower than 
C). as-is, it mostly just directly compiles a few misc things, like 
arithmetic operators and variable loads/stores and similar, leaving most 
everything else as call-threaded code (where the ASM code mostly just 
directly calls C functions to carry out operations).


in the selection sort test, the goal is basically to sort an array using 
selection sort. for a 64k element array, this is currently about 15s for 
C, and around 49s for BS. with the interpreter, this operation takes 
takes a good number of minutes.



*1:
current JIT, 1.2 kloc;
rest of core interpreter, 18 kloc;
rest of script interpreter (parser, front-end bytecode compiler, ...), 
32 kloc;
VM runtime (dynamic typesystem, OO facilities, C FFI, ...) + 
assembler/linker + GC: 291 kloc;

entire project, 1.32 Mloc.

so, yes, vs 291 kloc (or 1.32 Mloc), 1.2 kloc looks pretty small.

language rankings in project (excluding tools) by total kloc:
C (1.32 Mloc), BGBScript (16.33 kloc), C++ (16.29 kloc).

there may be some amount more script-code embedded in data files or 
procedurally generated, but this is harder to measure.



or such...

___
fonc mailing list
fonc@vpri.org
http://vpri.org/mailman/listinfo/fonc


Re: [fonc] deriving a POL from existing code

2013-01-09 Thread Loup Vaillant

David Barbour a écrit :

[…]
Creating a good POL can be difficult. (cf.
http://lambda-the-ultimate.org/node/4653)


From your link:

 It is easy to miss valuable symmetries or dualities.

That one is funny, because I sensed for a long time that this could
apply to OMeta-JS¹ (I didn't look at about other versions of OMeta).

 - Rules in OMeta aren't first class.  You sometime have to use Apply()
   explicitly, and to be passed as parameters, rules need to be named.
 - The implementation is less metacircular than it could be, making it
   significantly more verbose than necessary.
 - The scoping rule for bound variables is downright ugly: I can use a
   variable before it is even declared!
 - Other have mentioned that proper error messaging is hard, in part
   because of full backtracking.

Anyway, I had no idea about how to fix these for a long time. Then,
about a week ago, it hit me: OMeta rules can be viewed as monadic
parser combinators. It would get rid of most of the problems above.
(I'll post a proof of concept soon).

Anyway, back to the point:  How did Alex Warth (seem to) miss this?
He's probably smarter and more knowledgeable than I am, so… I guess
that

 It is easy to miss valuable symmetries or dualities.

and therefore,

 Creating a good POL can be difficult.

Which is a pity, because I expect the next silver bullet will come from
the wide use of POLs.

Loup.

[1]: http://www.tinlizzie.org/ometa-js/

___
fonc mailing list
fonc@vpri.org
http://vpri.org/mailman/listinfo/fonc


Re: [fonc] deriving a POL from existing code

2013-01-09 Thread John Carlson
I've been collecting references to game POLs on:
http://en.wikipedia.org/wiki/Domain-specific_entertainment_language ever
since I found Barney Pell's METAGAME.  I've also been collecting Game IDEs
on a similar page, which should probably be folded into the game engines
page.  Probably some of these POLs could be easily integrated into Maru
(they are based on s-expressions).  One of the more intriguing POLs is
EGGG, because it's very English-like, supposedly generates a number of
types of games, supports integrating functions from the base programming
language and generates Perl code.  Given enough time, I'd like to take the
EGGG language and develop something that STEPS uses.  One of the
difficulties Orwant had was the speed of the parsing in Perl...instead of
true parsing, he took a regular expression matching approach.

If you know of any game POLs that I don't have please add them by all means.

Thanks,

John


On Wed, Jan 9, 2013 at 4:43 AM, Loup Vaillant l...@loup-vaillant.fr wrote:

 David Barbour a écrit :

 […]

 Creating a good POL can be difficult. (cf.
 http://lambda-the-ultimate.**org/node/4653http://lambda-the-ultimate.org/node/4653
 )


 From your link:

  It is easy to miss valuable symmetries or dualities.

 That one is funny, because I sensed for a long time that this could
 apply to OMeta-JS¹ (I didn't look at about other versions of OMeta).

  - Rules in OMeta aren't first class.  You sometime have to use Apply()
explicitly, and to be passed as parameters, rules need to be named.
  - The implementation is less metacircular than it could be, making it
significantly more verbose than necessary.
  - The scoping rule for bound variables is downright ugly: I can use a
variable before it is even declared!
  - Other have mentioned that proper error messaging is hard, in part
because of full backtracking.

 Anyway, I had no idea about how to fix these for a long time. Then,
 about a week ago, it hit me: OMeta rules can be viewed as monadic
 parser combinators. It would get rid of most of the problems above.
 (I'll post a proof of concept soon).

 Anyway, back to the point:  How did Alex Warth (seem to) miss this?
 He's probably smarter and more knowledgeable than I am, so… I guess
 that

  It is easy to miss valuable symmetries or dualities.

 and therefore,


  Creating a good POL can be difficult.

 Which is a pity, because I expect the next silver bullet will come from
 the wide use of POLs.

 Loup.

 [1]: http://www.tinlizzie.org/**ometa-js/http://www.tinlizzie.org/ometa-js/


 __**_
 fonc mailing list
 fonc@vpri.org
 http://vpri.org/mailman/**listinfo/fonchttp://vpri.org/mailman/listinfo/fonc

___
fonc mailing list
fonc@vpri.org
http://vpri.org/mailman/listinfo/fonc


[fonc] deriving a POL from existing code

2013-01-08 Thread John Carlson
Has anyone ever attempted to automatically add meaning, semantics, longer
variable names, loops, and comments automatically to code?  Just how good
are the beautifiers out there, and can we do better?

No, I'm not asking anyone to break a license agreement.  Ideally, I would
want this to work on code written by a human being--me.

Yes, I realize that literate programming is the way to go.  I just have
never explored other options before, and would like to know about the
literature.

Say I am trying to derive language for requirements and use cases based on
existing source code.

I believe this may be beyond current reverse engineering techniques which
stop at the UML models.  I don't want models, I want text, perhaps written
in a Problem Oriented Language (POL).

That is, how does one derive a good POL from existing code?  Is this the
same as writing a scripting language on top of a library?

What approaches have been tried?

Here's the POL I want.  I want a POL to describe game rules at the same
order of magnitude as English.  I am not speaking of animation or
resources--just rules and constraints.  Does the Object Constraint Language
suffice for this?

Thanks,

John
___
fonc mailing list
fonc@vpri.org
http://vpri.org/mailman/listinfo/fonc


Re: [fonc] deriving a POL from existing code

2013-01-08 Thread David Barbour
Take a look at the Inform 7 language (http://inform7.com/) and its modular
'rulebooks'.

Creating good rules-based languages isn't trivial, mostly because ad-hoc
rules can interfere in ways that are awkward to reason about or optimize.
Temporal logic (e.g. Dedalus, Bloom) and constraint-logic techniques are
both appropriate and effective. I think my RDP will also be effective.

Creating a good POL can be difficult. (cf.
http://lambda-the-ultimate.org/node/4653)


On Tue, Jan 8, 2013 at 7:33 AM, John Carlson yottz...@gmail.com wrote:

 Has anyone ever attempted to automatically add meaning, semantics, longer
 variable names, loops, and comments automatically to code?  Just how good
 are the beautifiers out there, and can we do better?

 No, I'm not asking anyone to break a license agreement.  Ideally, I would
 want this to work on code written by a human being--me.

 Yes, I realize that literate programming is the way to go.  I just have
 never explored other options before, and would like to know about the
 literature.

 Say I am trying to derive language for requirements and use cases based on
 existing source code.

 I believe this may be beyond current reverse engineering techniques which
 stop at the UML models.  I don't want models, I want text, perhaps written
 in a Problem Oriented Language (POL).

 That is, how does one derive a good POL from existing code?  Is this the
 same as writing a scripting language on top of a library?

 What approaches have been tried?

 Here's the POL I want.  I want a POL to describe game rules at the same
 order of magnitude as English.  I am not speaking of animation or
 resources--just rules and constraints.  Does the Object Constraint Language
 suffice for this?

 Thanks,

 John

 ___
 fonc mailing list
 fonc@vpri.org
 http://vpri.org/mailman/listinfo/fonc




-- 
bringing s-words to a pen fight
___
fonc mailing list
fonc@vpri.org
http://vpri.org/mailman/listinfo/fonc


Re: [fonc] deriving a POL from existing code

2013-01-08 Thread Alan Kay
Yes indeed, I quite agree with David. 

One of the main points in the 2012 STEPS report (when I get around to finally 
finishing it and getting it out) is exactly David's -- that it is a huge design 
task to pull off a good DSL -- actually it is a double design task: you first 
need to come up with a great design of the domain area that is good enough to 
make it worth while, and to then try to design and make a math for the 
fruitful ways the domain area can be viewed.

This pays off if the domain area is very important (and often large and 
complicated). In the STEPS project both Nile (factors of 100 to 1000) and OMeta 
(wide spectrum flexibility and compactness) paid off really well. K-script also 
has paid off well because it enabled us to get about a 5-6 reduction in the 
Smalltalk code we had done the first scaffolding of the UI and Media in. Maru 
is working well as the backend for Nile and is very compact, etc.

In other words, the DSLs that really pay off are actual languages with all 
that implies.

But it's a little sobering to look at the many languages we did to learn about 
doing this, and ones that wound up being awkward, etc. and not used in the end.

On the other hand, our main point in doing STEPS was for both learning -- 
answering some lunch questions we've had for years -- and also to put a lot 
of effort into getting a handle on actual complexities vs complications. We 
purposely picked a well-mined set of domains -- personal computing -- so we 
would not have to invent fundamental concepts, but rather to take areas that 
are well known in one sense, and try to see how they could be captured in a 
very compact but readable form.

In other words, it's good to choose the battles to be fought and those to be 
avoided -- it's hard to invent everything. This was even true at Xerox PARC 
-- even though it seems as though that is what we did. However, pretty much 
everything there in the computing research area had good -- but flawed -- 
precursors from the 60s (and from many of us who went to PARC). So the idea 
there was brand new HW-SW-UI-Networking but leaning on the promising 
gestures and failures of the 60s. This interesting paradox of from scratch 
but don't forget worked really well.

Cheers,

Alan






 From: David Barbour dmbarb...@gmail.com
To: Fundamentals of New Computing fonc@vpri.org 
Sent: Tuesday, January 8, 2013 8:19 AM
Subject: Re: [fonc] deriving a POL from existing code
 

Take a look at the Inform 7 language (http://inform7.com/) and its modular 
'rulebooks'.


Creating good rules-based languages isn't trivial, mostly because ad-hoc rules 
can interfere in ways that are awkward to reason about or optimize. Temporal 
logic (e.g. Dedalus, Bloom) and constraint-logic techniques are both 
appropriate and effective. I think my RDP will also be effective. 


Creating a good POL can be difficult. (cf. 
http://lambda-the-ultimate.org/node/4653)



On Tue, Jan 8, 2013 at 7:33 AM, John Carlson yottz...@gmail.com wrote:

Has anyone ever attempted to automatically add meaning, semantics, longer 
variable names, loops, and comments automatically to code?  Just how good are 
the beautifiers out there, and can we do better?

No, I'm not asking anyone to break a license agreement.  Ideally, I would 
want this to work on code written by a human being--me.

Yes, I realize that literate programming is the way to go.  I just have never 
explored other options before, and would like to know about the literature.


Say I am trying to derive language for requirements and use cases based on 
existing source code.

I believe this may be beyond current reverse engineering techniques which 
stop at the UML models.  I don't want models, I want text, perhaps written in 
a Problem Oriented Language (POL).

That is, how does one derive a good POL from existing code?  Is this the same 
as writing a scripting language on top of a library?

What approaches have been tried?

Here's the POL I want.  I want a POL to describe game rules at the same order 
of magnitude as English.  I am not speaking of animation or resources--just 
rules and constraints.  Does the Object Constraint Language suffice for this?

Thanks,

John

___
fonc mailing list
fonc@vpri.org
http://vpri.org/mailman/listinfo/fonc





-- 
bringing s-words to a pen fight 
___
fonc mailing list
fonc@vpri.org
http://vpri.org/mailman/listinfo/fonc


___
fonc mailing list
fonc@vpri.org
http://vpri.org/mailman/listinfo/fonc