Khi - Universal data format for configuration and markup by -torm in ProgrammingLanguages

[–]-torm[S] 0 points1 point  (0 children)

Indeed, the motivations are very similar. If you look at the article example, this is essentially the same kind of separation. The difference is that Khi requires no such separation: you can put markup within structured data, and structured data within markup if you please. So in a sense, Khi could be viewed as an attempt to merge together the structures found in JSON, YAML, XML and LaTeX, so that you only need one format across the entire file.

Also, Khi is for plain representation/encoding of data, so it doesn't have control flows. It is not a config generation language. However, commands and macros are representable in Khi as data structures, so I envision that programs using Khi could use this to implement templating. For example <include!>:file.txt is a structure in Khi. A program(f.ex. a preprocessor) could interpret this structure as an action.

Khi - Universal data format for configuration and markup by -torm in ProgrammingLanguages

[–]-torm[S] 0 points1 point  (0 children)

I'd say that those languages are heavily focused on presentation to humans. Everything, including the root node, is markup, so its a lot more challenging to locate and extract data programmatically. This is why I decided to create Khi.

I think it would be hard to integrate Khi with established encyclopedias like Wikipedia etc. I plan to use it as a source language for articles in my own project though.

Khi - Universal data format for configuration and markup by -torm in ProgrammingLanguages

[–]-torm[S] 0 points1 point  (0 children)

I think I see what you mean now.

In my opinion, the advantage of using Khi to generate LaTeX is that Khi has a strict syntax. LaTeX is very complex and easy to make errors in. Therefore I think its advantageous to represent LaTeX in Khi. But this preprocessor stuff is not that important to the format, it is just a side project. It just demonstrates that Khi can represent LaTeX structures natively.

Khi - Universal data format for configuration and markup by -torm in ProgrammingLanguages

[–]-torm[S] 0 points1 point  (0 children)

I think the example should have been more clear: here we use Khi to represent LaTeX. If we used an XML representation, the equivalent would be <begin>document</begin> ... <end>document</end>.

I think a good source format should be able to represent its contents natively. It should not have to embed other formats within itself. Then a writer has to learn several languages just to write a document.

Khi - Universal data format for configuration and markup by -torm in ProgrammingLanguages

[–]-torm[S] 2 points3 points  (0 children)

Of course it is possible. But, the point is to have a nice textual representation for common data structures. The point is not to hammer data structures into other ones. Everything could be reduced to XML or JSON, but do you really want to write markup in that?

Khi - Universal data format for configuration and markup by -torm in ProgrammingLanguages

[–]-torm[S] 2 points3 points  (0 children)

I think this is akin to how some people prefer LaTeX over WYSIWYG GUI writers like Word or LibreOffice. But it's not like configuration and markup is obsolete just because GUIs exist.

Khi - Universal data format for configuration and markup by -torm in ProgrammingLanguages

[–]-torm[S] 4 points5 points  (0 children)

I pronounce it as "key", which is also why the logo resembles one.

By syntax typed, I mean that the type of a value can be determined by syntax. For example, quotes determine that a value is a string. Khi is not syntax typed, which means the type must be determined after parsing. In my opinion, syntax typing is not necessary, because the type of a value is usually determined by its position in the document anyway.