Hacker News new | past | comments | ask | show | jobs | submit login
Language Hacking in a Live Programming Environment (ohmlang.github.io)
105 points by iamwil on Sept 1, 2016 | hide | past | favorite | 10 comments



This looks amazing! I would love to have access to a tool like this for working on my current programming language project; is the tool available for download somewhere? I don't see anything about the editor in the Ohm repo[0].

Another cool thing would be to make an Ohm-to-Bison compiler; I'm not about to reimplement my whole language in Javascript, but I would love to prototype the grammar in the Ohm editor and then compile it down to Bison.

[0]: https://github.com/cdglabs/ohm


The grammar language looks unexciting, which is exactly what I want from a grammar language. Some kind of conversion is probably possible. But it looks like one of the really cool bits is being able to add actions to rules so easily, and that won't be as fluid in anything but Javascript.

I'd love to play with the editor too.


Looks like you can play with the interactive editor as discussed in the paper at https://ohmlang.github.io/editor



Interesting to see that there is some VPRI / Smalltalk / Squeak influence with HARC/YC Research http://vpri.org/html/team_bios/yoshiki.htm aboard

There is also Moose that can create grammars quite easily.

http://www.moosetechnology.org/ https://en.wikipedia.org/wiki/Moose_(analysis)

Using PetitParser, GTInspector, and other such tooling, visual construction, debugging, and evaluation of grammars and parsers is a breeze.


As far as I can see, they are bringing feature 9 from pg's article "What Made Lisp Different" [0].

[0]: http://www.paulgraham.com/diff.html


This was a good write-up about Ohm. Really cool stuff.

https://www.pubnub.com/blog/2016-08-30-javascript-parser-ohm...


Looks quite interesting. I have a few questions that I couldn't find answers for in the documentation.

Does Ohm help with type checking in any way?

Does Ohm support indentation based syntax?

Does Ohm handle language composition (eg. JavaScript or CSS inside HTML)?


Hi, I'm one of the authors of Ohm.

> Does Ohm help with type checking in any way?

Not sure what you mean here...are you asking if Ohm has any support for type checking a language that you create using Ohm?

If so, the answer is no -- not yet. But I could definitely imagine implementing a pluggable Semantics that could make this really easy to do for most languages. We are happy to accept pull requests :-)

> Does Ohm support indentation based syntax?

No, it's not (yet) possible to do this directly. Though it can be done with a simple preprocessing step that expands the source code to include explicit indent/dedent tokens.

It's definitely something we'd like to support, we just haven't settled on how.

> Does Ohm handle language composition (eg. JavaScript or CSS inside HTML)?

Yes and no. Right now, the only means of composition Ohm supports is grammar inheritance. This makes sense for things like ES5 and ES6, but not so much for the use case you describe. The problem is that inheritance won't work if you have any name clashes in the grammars.

We've considered something traits-like (http://scg.unibe.ch/archive/phd/schaerli-phd.pdf), but we're not sure whether it's worth the additional language complexity. A simple workaround for the use case you describe is to just parse in two phases: first match the HTML, allowing `any*` inside a script tag, then match the JavaScript inside a semantic action.

If you're interested in more details, you might want to read the paper that we'll be presenting at DLS in Nov: https://ohmlang.github.io/pubs/dls2016/modular-semantic-acti...


Fair enough, and thank you for the info :) It looks like a very interesting project.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: