6 ms·
Where is the source code of a compiler? It looks like it's written in Java but there are no source code files in corresponding GitHub repo.
by garganzol 8y ago
Where is the source code of a compiler? It looks like it's written in Java but there are no source code files in corresponding GitHub repo.
- rileyphone 8y agoIt's in ferret.org, apparently.
- phoe-krk 8y agoALL of the code seems to be stored inside the org-mode file, https://github.com/nakkaya/ferret/blob/master/ferret.org https://github.com/nakkaya/ferret/blob/master/ferret.org - which is the most unusual form of source code organization that I have ever seen.
- Quequau 8y agoUsing org-mode for literate programming isn't entirely unheard of.
- phoe-krk 8y agoI guess I had never seen literate programming taken to such an extreme before. This was an actual surprise for me.
- antt 8y agoThis has been my go-to way of programming anything where I'm the primary person responsible for it. With pandoc you get a system that can export to any format under the sun. The highlight so far was exporting a problematic code portion with the literate explanation around it and a pretty basic asymptotic analysis in latex to docx, code highlighting, math formulas, tables all worked without human intervention. It ended up in a power point that I'm told was very well received.
- antt 8y agoThere's singles of us! If you want to extract it run M-x org-babel-tangle and you will end up with the usual source files and directories installed relative to the location of the org file. I doubt there's a dozen people in the world that do it. But it is surprisingly useful and powerful when you get used to it. If anyone in Melbourne is interested in learning about this I have been toying with the idea of running a workshop on it. I'm in the process of getting the detangle working for noweb mode. The current implementation fakes it with regex which force you to write code linearly instead of literately. But even if you can't detangle arbitrarily nested code it's magic to see changes in a source file appear in the right source code block.
- Touche 8y agoHow do you deal with having to scroll such a large file? That's the biggest turn-off to literate programming for me. I don't like code files more than a couple hundred lines of code. Search isn't enough for me.
- Jtsummers 8y agoOrg mode will let you collapse trees and source blocks. You can also narrow the view to a sub tree. This makes navigation much easier.
- heavenlyblue 8y agoSo how is navigating the file tree any different from navigating the source code tree? Just don’t tell me “you can see the context” as any proper codebase would probably not be linear in code flow anyway.
- jacobush 8y agoThat it's not different is kind of a good point? Some people use several Emacs windows (or frames or whatever) but all of them peeking into the same file, but in to different locations of it.
- 8y ago
- eigenspace 8y agoI actually just started dong this a few days ago and I’m loving it so far. I have it configured so that every time I save, emacs runs org-tangle and all my code ends up in the proper directories but I never have to touch it there, I can just stay in org mode and keep different ‘files’ of code in different collapsible sections making moving around much easier!
- antt 8y agoLook at org-babel-detangle and have your mind blown[0]. [0] Mostly, the current implementation works only with source blocks that are linearly added one after the other and don't use the <<noweb reference>> in code blocks.
- tincholio 8y agoI had a similar setup, but ended up coding a toggle for it, as it can get rather long as your source grows. In case you find it useful: ;; Tangle Org files when we save them (defun toggle-org-tangle-on-save() (interactive) (if (bound-and-true-p org-tangle-on-save) (setq-local org-tangle-on-save nil) (setq-local org-tangle-on-save t)) (message (if org-tangle-on-save "Enabled tangling on save" "Disabled tangling on save")))
- enitihas 8y agoJust curious, how does github manages to render org files so flawlessly, including embedded code snippets. I thought emacs was the only popular environment supporting org files.
- eigenspace 8y agoGithub seems to play quite well with Org. Little known fact: If you give your repo a README.org instead of a README.md, github will show that file just like how it shows a regular README.md.
- peatmoss 8y agoUnfortunately, the same can't be said of Bitbucket. At one point I voted for or commented on a feature request for it, and I pretty routinely get notified when someone else discovers the lack of org-mode support on Bitbucket. At this point, I'm convinced Atlassian hates happiness, or there is some shameful architectural reason why they cannot support more than Markdown for their READMEs. Given the number of vociferous responses to that feature request, there would appear to demand.
- omaranto 8y ago> I thought emacs was the only popular environment supporting org files. Pandoc has a pretty decent Org Mode parser and writer.
- omaranto 8y agoThat's called literate programming. Maybe the most famous example is the source code for TeX, a single ~25,000 line file (http://tug.org/texlive/devsrc/Build/source/texk/web2c/tex.web http://tug.org/texlive/devsrc/Build/source/texk/web2c/tex.we...) that can be used to make a TeX compiler, or produce a book explaining the implementation.
- nine_k 8y agoThere's a "building from sources" section on https://ferret-lang.org/ https://ferret-lang.org/, but I could not easily detect where the source is on github. Update: It needs to be extracted from an org file, and by default Github renders the org file so that the source is not visible.
- zellyn 8y agoDo you not see all the source code in https://github.com/nakkaya/ferret/blob/master/ferret.org https://github.com/nakkaya/ferret/blob/master/ferret.org?
- gvb 8y agoOr click the "raw" button on the github source page. https://raw.githubusercontent.com/nakkaya/ferret/master/ferret.org https://raw.githubusercontent.com/nakkaya/ferret/master/ferr...