On 10/02/2015, at 6:24 AM, Ryan Gonzalez wrote: > Scheme is horrible, not hard.
If you can write Scheme .. please help! [Because I can't :] I am so used to pattern matching in Ocaml and Felix I can't write the equivalent code in crap languages without it any more (like Scheme .. C++ .. Python .. err ..) So one big aim of the interpreter thing is to do pattern matching. In particular with that .. the existing macro processor could probably be thrown out. In particular look at the grammar and especially src/lib/grammar/grammar_scheme_support.fsyn I would actually like to rework the whole front end of the flxg compiler in scheme. What I mean is that the core workhorse algorithms would still be in Ocaml, but they'd be sequenced by scheme code. OCS Scheme is written in Ocaml and allows extra primitive procedures and data types written in Ocaml to be added to it. One particular goal is that at the moment, I have managed to get it so that literals and identifiers are actually lexed and parsed IN the grammar, that is, the Dypgen+Scheme is actually used to define integer, float, and string literals. So I can say Felix has no keywords, no grammar, and not even any literals: its all in the library. But there are some .. er .. HACKS! :-] One of them is constant folding. It's done in Ocaml. So it only works for bool, string, int. It should be done in the library, with Scheme. > This looks great...but I can't help but feel like this would cause confusion > in the future involving the interaction between Felix, Scheme, and Schemlix > (what I'm calling this :). And sister Sche-minx? > Couldn't a simpler solution be used instead? Why not just embed Lua or > Python+Hy? How do I embed Lua or Python in Ocaml code? And why would I embed such poor languages anyhow? The parser technology is Generalised LR which works by simultaneously attempting multiple parses and discarding failures. This means that except for definite constructions such as top level statements, the action code MUST be purely functional, since the actions may be discarded. Sure, you could embed Lua in Felix but why would you bother when you can write Felix? I actually did it at one stage. Lua is a bit of a hack I'm afraid, doesn't even parse cleanly. The thing is you can design and implement a much better interpreter in Felix in a few lines of code, and the result will integrate with Felix much better. As to Python, its the other way: no sense embedding Py in Felix, but you can use Felix to make Python modules for those unfortunate souls that have to write real applications using Python. -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language