문제

There is a old computer language called APL. Could this be implemented in Scala as a DSL?

http://en.wikipedia.org/wiki/APL_%28programming_language%29

도움이 되었습니까?

해결책

Someone could probably give a better answer than this, but this is my initial thought:

  1. A Scala DSL should in theory be able to implement any programming language because it could build up an arbitrary structure representing the syntax, and then evaluate that.

  2. A Scala DSL could not exactly replicate APL syntax for many reasons, one of which is that

    'single quotes'

can denote a string in APL, but not in Scala. Also (from the wikipedia page)

×/2 3 4

wouldn't be valid Scala.

I don't know how close you could get, though...

다른 팁

A Javascript implementation exists here: https://github.com/ngn/apl

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top