Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Concatenative languages [1] have the property that every token sequence is a valid program.

I don't think this is correct? Concatenative languages have the property that if a and b are both valid programs, that the program a || b is valid (where || means "concatenate"). But that property doesn't imply that every sequence of tokens is valid.

For example, in Cat,

  [1 2
is not grammatically valid.


You're right. I should have qualified it as "some concatenative languages".


Is there a particular term for concatenative languages with this property?


Trivially it's all concatenative languages where each single token is valid.

Not sure if they have a name but I would be tempted to call it a free language.


So does Prolog count as a concatenative language given the standard definition of concatenative languages?

For context, a Prolog program is a set of definite clauses so the union of two Prolog programs is a Prolog program.

In fact, this property forms the basis of the concept of (syntactic) generality in Prolog: if P1, P2, P3 are three Prolog programs such that P1 is the union of P2 and P3, then we say that P1 generalises each of P2 and P3. Does this concept of generality also exist for concatenative languages?


They used an OCR program though, which probably has a bias toward attempting to close parentheses.




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

Search: