# k code from q code

**URL:** https://forum.kx.com/t/k-code-from-q-code/10771
**Category:** Community Support
**Tags:** kdb-and-q
**Created:** [February 4, 2016, 5:24pm UTC](https://forum.kx.com/t/k-code-from-q-code/10771 "2016-02-04T17:24:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![User7](https://avatars.discourse-cdn.com/v4/letter/u/7ea924/32.png) [@User7](https://forum.kx.com/u/User7)
#### Post date: [February 4, 2016, 5:24pm UTC](https://forum.kx.com/t/k-code-from-q-code/10771/1 "2016-02-04T17:24:00Z")

</div>

Can we get k code from q codenfile which is lets say 100 lines big in an EASY way ?

---

<div class="post-metadata">

### Author: ![effbiae](https://avatars.discourse-cdn.com/v4/letter/e/ecae2f/32.png) [@effbiae](https://forum.kx.com/u/effbiae)
#### Post date: [February 6, 2016, 5:45am UTC](https://forum.kx.com/t/k-code-from-q-code/10771/2 "2016-02-06T05:45:00Z")

</div>

There may be an easy way to get k code from a q file.&nbsp; Some warnings:

til is ! in k:

q)til 3

0 1 2

k)!3

0 1 2

but q specializes ! with a type check (in q/q.k) :

q)til

k){$[0\>@x;!x;'`type]}

so the parse tree of “til 1”

q)0N!parse “til 1”;

(k){$[0\>@x;!x;'`type]};1)

which is going to make for a pretty messy ouput from a “q2k” converter.

further, q’s parse will not parse a file, only a string (containing no newlines), so you’re going to have problems parsing comments

i’m sure if there were a q2k program, someone would have got back to us.

best,&nbsp;

jack.

---

<div class="post-metadata">

### Author: ![effbiae](https://avatars.discourse-cdn.com/v4/letter/e/ecae2f/32.png) [@effbiae](https://forum.kx.com/u/effbiae)
#### Post date: [February 7, 2016, 1:23am UTC](https://forum.kx.com/t/k-code-from-q-code/10771/3 "2016-02-07T01:23:00Z")

</div>

i just fixed the minor typo and it’s even smart enough to translate til to !

bravo
