Thanks a lot for the detailed reply. Yes, I am reading through the tutorial pages and they are very helpful. Actually page 1 (hello world page) says that "let's look at what all these files mean later". And what you had written in your email is a beautiful *enough* explanation. My suggestion would be to just copy&paste this to the doc until further improvements could be made.
Looking to learn more of the language modification parts. Thanks a lot, krishna. Erick Tryzelaar wrote: > Krishna Srinivasan wrote: >> >> PS - I have this habit of calling my files >> >> 1hello.x 2hello.x....when I try examples with >> > >> > Oh thats interesting! I have no idea what will happen if you do >> that :) >> > I'll have to check that out. I also don't know what felix thinks of >> >> >> I am sorry..I actually saved that as 1hello.flx, >> 2hello.flx...etc. (not *.x but *.flx). >> But the error part is still the same - I think >> >> Here is the terminal output : >> >> [snip] > > Looks like it's the felix-to-c++ name mangler isn't handling illegal > first characters. Shouldn't be too hard to fix. > >> > Glad to hear it. Felix changes *a lot*, and so the next release could >> > change dramatically from the last. So, if you have any complaints, >> > please let us know! >> >> Now that you ask....: >> >> I was reading the old archive messages and looks like >> a lot of work is done to get felix to the c++ folks. >> >> On the other hand, felix looks/feels like python in >> most of the respects. >> >> So I wonder why not take that a few more steps and make it >> as close to python as possible ? (atleast a subset >> of python). >> >> [I understand if the whitespace and colon-newline-delimiters >> and other stuff are not carried forward - but a lot of other >> syntactical parts] > > Well, we actually have a case-insensitive prototype extension. I'm not > sure if it's currently working in svn, but I think you can do something > like this: > > fun foo (x:int) $$ > print "hello" > endl > ; > > I've never tried it myself though. I'm also not sure if we're going to > keep it. > >> Ocaml has this very nice camlp4 [preprocessor pretty printer]. >> I was initially planning on using this to translate a subset >> of python to ocaml. How hard would it be to make felix >> do that kind of language/syntax modification easy ??? > > Ha! Our language modification kicks ass pretty much everyone's ass. > Seriously kicks ass. Skaller's putting the final touches on it. > Basically, the entire felix language is a language extension. We use a > GLR parser to convert the felix language into scheme s-expressions, > which is then converted to an AST. This means that fundamentally the > core language is really tiny, and everything else can be done on top. > This also means that you can have scoped local syntax enhancements. I'm > not sure if anyone else other than lisp/scheme are really capable of > this. It will be really interesting with what people will come up with. > >> Also, when/if you can, please point me to docs that >> say about : >> 1. how to create runnable binaries >> (so I can do ./hello) > > You can find the command help in the man pages, which are also online here: > > http://felix.sourceforge.net/doc/htmlman/felix_1.html > > To generate a binary, just do: > > flx --static hello.flx > >> 2. What do all those files ? (when I do a flx hello.flx) > > Sigh. Someday I'd like to fold all of these into one file, or at least a > directory. Anyway: > > .cpp, .hpp: > felix generates c++ file as it's assembly language, so these are the > documents. > > .why: > another one of the interesting prototype. Why is a generator for various > automated proof solvers. See here for more info: > http://why.lri.fr/index.en.html > > .par: > a cache of the parsed felix code > > .resh: > what packages this felix code depends on > > .rtti: > runtime type info about the felix datatypes for the garbage collector (I > believe) > >> 3. Any design info/notes as to why there is a val and var >> and why there is a proc and fun. > > val (values): > http://felix.sourceforge.net/doc/tutorial/introduction/en_flx_tutorial_0005.html > > > > var (variables): > http://felix.sourceforge.net/doc/tutorial/introduction/en_flx_tutorial_0006.html > > > > Values and variables are similar. The difference is that variables can > be changed, while values cannot. There are a couple advantages to this > than just having everything writable, such as in c and python. The main > ones are that code is much more understandable if you use values instead > of variables since values can't be modified, and we can do more > optimizations with values than we can with variables. > > proc (procedures): > http://felix.sourceforge.net/doc/tutorial/introduction/en_flx_tutorial_0011.html > > > > fun (functions): > http://felix.sourceforge.net/doc/tutorial/introduction/en_flx_tutorial_0009.html > > > > Felix functions are functional. Functions return data, and aren't > allowed to have side effects (although this isn't enforced yet). > Procedures are the inverse. They can have side effects but can't return > data. There's also one other construct like this called gen (or > generator). They're functions but they can have side effects. Basically, > the compiler reserves the right to move around, duplicate, remove, or > reduce functions. For instance, say you have this: > > fun foo() = { > print "foo"; endl; > return 0; > } > > proc bar() { > val x = foo(); > print "bar"; endl; > } > > bar(); > > > Because we never actually use "x" in bar, the compiler has the right to > actually elide the call to foo. So, "foo" may never get printed out. > However, procedures and generators are guaranteed to be called. > >> I also just found a ton of example programs in bagley directory, >> they are very useful as well. Will check that out. > > If you want to check out some more programs, try > build/tools/flx_pkgconfig.flx, build/tools/webserver.flx, or the demos > in build/demos/sdl. > > -e > ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Felix-language mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/felix-language
