Open indexzero opened 12 years ago
Thanks very much for the pointer about a language guide, and for making a start. I've put this on my todo list.
The language is actually smaller than it appears. The stuff you see in the Isla code examples is a mix of core language features (only assignment and instantiation, at the moment), built in types (like list
), and the storytelling environment that includes its own special types (like room
). Further, there is the story-playing environment that has the rudimentary set of commands like look
and go
.
Some specifics:
Tokens like my
, name
, exit
and summary
are actually simply attribute identifiers on objects.
room
is an object type. When an object type is coupled with an identifier in an expression like palace is a room
, this instantiates an object of type room
and assigns it to palace
.
is
is a keyword. It is, indeed, equivalent to =
in other programming languages.
Thanks again for your suggestion and starting document. It's really nice that you are interested.
@maryrosecook Great.
To my other point: I'd be happy to help with a lexer / parser implementation in Javascript. I really think there could be some very engaging ways to teach programming in the browser without having to make calls to a clojure backend all the time.
Not having a formal language guide is of course the big blocker for that because I don't want to stray from your vision for the language :)
That would be so great! I think you are totally right: a client side implementation would really help with teaching.
I am going to continue work on the language guide right this second. I will try and have something for you by tomorrow night.
Would it make sense to write the other lexer/parser in ClojureScript, rather than pure JavaScript? I know even less ClojureScript than I do Clojure, but I wonder if that might allow for some degree of code reuse?
Of course, now that I think about it, ClojureScript isn't self-hosting (yet), so you wouldn't eliminate the need for the JVM, which might defeat the purpose.
Yes, it would allow quite a lot of code reuse. And it would be possible to produce a client-side-only environment, which would be great for deployment. But, as you say, a JVM would still be required to work on the Isla language itself.
I chose to write the compiler in Clojure because I wanted to learn Clojure. I think JS is probably a better all-round implementation language. Isla is not that complicated, so its compiler doesn't need to be written in a heavy duty language. Speed of execution is almost irrelevant. And the language environment is suited to the web, because that is where it will have the greatest reach.
Personally I agree with @maryrosecook
Isla is not that complicated, so its compiler doesn't need to be written in a heavy duty language.
Given the limited number of keywords I think lexing and parsing would be pretty straight forward with pure JS. Newlines are significant which also simplifies things. Naturally I'm biased here, but I've written a lexer / parser for Gherkin in the past and it wasn't much trouble. Got through most of it in 2 days.
I think if a JS compiler were written, it would be a net win. So, if you'd like to go for it, @indexzero , please do. I'd be excited to help out. I plan to continue implementing a compiler in Clojure just for my own education.
@indexzero I have bashed out a language guide. Let me know if I've missed out any information you need.
I have only written a guide for the language itself. I have not, yet, written the documents that describe the story writing environment or the story playing environment. I'm can't really do these yet, because both are in a great amount of flux as I experiment with stuff. Let me know if this is a problem and I can start making some concrete decisions sooner rather than later.
https://github.com/maryrosecook/isla/blob/master/languageguide.md
@maryrosecook Nice! I'll take a stab at the lexer this weekend. Should I fork? Or just create an isla.js
repository? This is your call, isla.js
makes sense only if the mainline will continue to be clojure
I think fork. I think it would be cool to keep both compilers in the same repository, for now. Then, a canonical compiler can emerge.
I'm really excited to see what you come up with.
@maryrosecook Pretty much done with the Javascript lexer.
Next up is parsing. The sample syntax in hallway.is
suggests that items
is a reserved keyword that does not need assignment.
hallway is a room
hallway summary is 'It is dark. You hear a girl crying.'
hallway items add rose
I would have expected:
hallway items is list
to be required before the hallway items add rose
. Is that expected or just a typo in the test fixture?
Fantastic! This is so exciting. Thanks very much for getting involved with the project.
That's a good question about hallway items.
The way this works is that room
is actually a type with four attributes: name
(a string), summary
(a string), items
(a list) and exit
(an object reference). When you write hallway is a room
, you are instantiating an object of type room
and assigning the object to hallway
. Thus, the hallway
attribute items
is automatically instantiated as a list when hallway
is instantiated.
(By the way, list is also a type, so if you want to instantiate a variable as a list, you would go mylist is a list
, not mylist is list
.)
Is that clear?
@maryrosecook Got it. But shouldn't the hallway.is
script throw for an undefined type room
? It is not defined in that script. Or is room
a built-in type?
Great point. The room
type is defined by the storytelling execution context. See extra-types
in library.clj for where the general Isla execution context gets assembled and types
in library.clj for where the room
type is created and passed to the general execution context for storytelling.
I will prioritise writing the Isla story environment guide today and tomorrow to make clearer the way this all works.
@indexzero Hiya. I've bashed out the Isla story environment guide. Let me know if anything is unclear, or if you need more information and I'll get straight back to you.
Excellent project! Story environment guide now at https://github.com/maryrosecook/isla/wiki/Story-environment-guide
Ah. Thanks. However, things have been changing in my head, recently. I'm probably going to abandon the story environment. I'm still working on the core language, but I think the interactive text adventures are probably the wrong way to go.
I have been teaching Isla to a bunch of non-programmers. With each one, the conversation went something like this:
Me: "So, you now know the whole Isla language." Them: "That was pretty easy." Me: "Great! Now we get to the fun stuff. We're going to make something. We're going to make an old school interactive text adventure." Them: "What's an old school interactive text adventure?" Me: --five minutes of explaining and showing examples-- Them: "Got it." Me: "Before we start, let's play through an example text adventure I wrote for Isla." Me: --five more minutes of teaching the commands you use to interact with an Isla text adventure-- Them: "Got it." Me: "OK, let's try and write a story. Start by typing 'palace is a room'." --interlude of half an hour of teaching the story environment api--
What I realised was that the story telling environment requires the programmer to learn a ton of facts that have nothing to do with programming. Further, non-programmers are not excited about making something in a genre they have never heard of.
I've got some ideas about what will replace the story telling environment. I'll say more about this soon.
Interesting - I'm not sure what the best forum for this is - I thought 'the story' was a great idea for motivating programming. Often it's motivated by some maths challenge, which of course only appeals to kids with an interest in maths (or numbers) - whereas we all understand stories.
But even if 'the story' is compelling, it doesn't mean it's wrong to replace an existing API. And sounds like your field testing is giving good feedback.
On 24 October 2012 13:44, Mary Rose Cook notifications@github.com wrote:
Ah. Thanks. However, things have been changing in my head, recently. I'm probably going to abandon the story environment. I'm still working on the core language, but I think the interactive text adventures are probably the wrong way to go.
I have been teaching Isla to a bunch of non-programmers. With each one, the conversation went something like this:
Me: "So, you now know the whole Isla language." Them: "That was pretty easy." Me: "Great! Now we get to the fun stuff. We're going to make something. We're going to make an old school interactive text adventure." Them: "What's an old school interactive text adventure?" Me: --five minutes of explaining and showing examples-- Them: "Got it." Me: "Before we start, let's play through an example text adventure I wrote for Isla." Me: --five more minutes of teaching the commands you use to interact with an Isla text adventure-- Them: "Got it." Me: "OK, let's try and write a story. Start by typing 'palace is a room'." --interlude of half an hour of teaching the story environment api--
What I realised was that the story telling environment requires the programmer to learn a ton of facts that have nothing to do with programming. Further, non-programmers are not excited about making something in a genre they have never heard of.
I've got some ideas about what will replace the story telling environment. I'll say more about this soon.
— Reply to this email directly or view it on GitHubhttps://github.com/maryrosecook/isla/issues/2#issuecomment-9737895.
I have decided to try allowing the Isla language to plug in to demos/environments/examples written in JavaScript.
Imagine a planet simulator written in JS by an experienced programmer. They model a sun and a centre of gravity that allows planets to whirl around it. A child then uses Isla to define the planets: color, density, size, starting position. The simulator sucks in the Isla code, evaluates it and sets up the specified planets.
I am probably going to change the canonical Isla compiler to be the JS one I've been working on. JS is much better suited to the above idea. It runs on both browser and server. It has a ton of libraries that are good for visual output.
I think this let people write all sorts of JS plugin environments that will hopefully interest children.
On 24 Oct 2012, at 13:14, BigEd notifications@github.com wrote:
Interesting - I'm not sure what the best forum for this is - I thought 'the story' was a great idea for motivating programming. Often it's motivated by some maths challenge, which of course only appeals to kids with an interest in maths (or numbers) - whereas we all understand stories.
But even if 'the story' is compelling, it doesn't mean it's wrong to replace an existing API. And sounds like your field testing is giving good feedback.
On 24 October 2012 13:44, Mary Rose Cook notifications@github.com wrote:
Ah. Thanks. However, things have been changing in my head, recently. I'm probably going to abandon the story environment. I'm still working on the core language, but I think the interactive text adventures are probably the wrong way to go.
I have been teaching Isla to a bunch of non-programmers. With each one, the conversation went something like this:
Me: "So, you now know the whole Isla language." Them: "That was pretty easy." Me: "Great! Now we get to the fun stuff. We're going to make something. We're going to make an old school interactive text adventure." Them: "What's an old school interactive text adventure?" Me: --five minutes of explaining and showing examples-- Them: "Got it." Me: "Before we start, let's play through an example text adventure I wrote for Isla." Me: --five more minutes of teaching the commands you use to interact with an Isla text adventure-- Them: "Got it." Me: "OK, let's try and write a story. Start by typing 'palace is a room'." --interlude of half an hour of teaching the story environment api--
What I realised was that the story telling environment requires the programmer to learn a ton of facts that have nothing to do with programming. Further, non-programmers are not excited about making something in a genre they have never heard of.
I've got some ideas about what will replace the story telling environment. I'll say more about this soon.
— Reply to this email directly or view it on GitHubhttps://github.com/maryrosecook/isla/issues/2#issuecomment-9737895.
— Reply to this email directly or view it on GitHub.
Sounds great!
On Thursday, 25 October 2012, Mary Rose Cook wrote:
I have decided to try allowing the Isla language to plug in to demos/environments/examples written in JavaScript.
Imagine a planet simulator written in JS by an experienced programmer. They model a sun and a centre of gravity that allows planets to whirl around it. A child then uses Isla to define the planets: color, density, size, starting position. The simulator sucks in the Isla code, evaluates it and sets up the specified planets.
I am probably going to change the canonical Isla compiler to be the JS one I've been working on. JS is much better suited to the above idea. It runs on both browser and server. It has a ton of libraries that are good for visual output.
I think this let people write all sorts of JS plugin environments that will hopefully interest children.
On 24 Oct 2012, at 13:14, BigEd <notifications@github.com<javascript:_e({}, 'cvml', 'notifications@github.com');>> wrote:
Interesting - I'm not sure what the best forum for this is - I thought 'the story' was a great idea for motivating programming. Often it's motivated by some maths challenge, which of course only appeals to kids with an interest in maths (or numbers) - whereas we all understand stories.
But even if 'the story' is compelling, it doesn't mean it's wrong to replace an existing API. And sounds like your field testing is giving good feedback.
On 24 October 2012 13:44, Mary Rose Cook <notifications@github.com<javascript:_e({}, 'cvml', 'notifications@github.com');>> wrote:
Ah. Thanks. However, things have been changing in my head, recently. I'm probably going to abandon the story environment. I'm still working on the core language, but I think the interactive text adventures are probably the wrong way to go.
I have been teaching Isla to a bunch of non-programmers. With each one, the conversation went something like this:
Me: "So, you now know the whole Isla language." Them: "That was pretty easy." Me: "Great! Now we get to the fun stuff. We're going to make something. We're going to make an old school interactive text adventure." Them: "What's an old school interactive text adventure?" Me: --five minutes of explaining and showing examples-- Them: "Got it." Me: "Before we start, let's play through an example text adventure I wrote for Isla." Me: --five more minutes of teaching the commands you use to interact with an Isla text adventure-- Them: "Got it." Me: "OK, let's try and write a story. Start by typing 'palace is a room'." --interlude of half an hour of teaching the story environment api--
What I realised was that the story telling environment requires the programmer to learn a ton of facts that have nothing to do with programming. Further, non-programmers are not excited about making something in a genre they have never heard of.
I've got some ideas about what will replace the story telling environment. I'll say more about this soon.
— Reply to this email directly or view it on GitHub< https://github.com/maryrosecook/isla/issues/2#issuecomment-9737895>.
— Reply to this email directly or view it on GitHub.
— Reply to this email directly or view it on GitHubhttps://github.com/maryrosecook/isla/issues/2#issuecomment-9792503.
First Fascinating stuff. I really like your creativity here. I got turned onto computers through logo when I was 6 so teaching languages always have a special place in my heart.
Have you begun to formalize the language guide yet? It's usually one of the first things to do in these situations before going off an implementing all the language features.
Based on reading the code base and some example code:
That's all I got right now. Have you considered a Javascript version of the parser? It would make playing this in the browser much easier.