On 11/11/2012, at 7:51 AM, Ryan Kluzak wrote:

> Notes so far:
> 
> 1) Felix, (at least the flx.exe front-end) relies on the existence of the 
> ocamlms directory.  My goal is to have a windows install that doesn't rely on 
> ocaml or any one compiler.  Hard to say if I'm missing something, but I don't 
> think ocaml is needed to compile a felix program.  

Felix doesn't need Ocaml. It's needed only to build flxg. the Felix  compiler.
How is the dependence on ocamlms directory manifest?

Unless you ended up with a bytecode compiler .. that needs ocamlrun executable
to execute the bytecode. This shouldn't happen though, flxg should be built as
native code Windows statically linked binary. 

Note that by default Ocaml bytecode STILL makes
an *.exe but it just contains a thunk which runs ocamlrun on the bytecode.
You do NOT want Ocaml bytecode! Its slow, and you have the portability
problem you mention. 

Actually it is possible the generated binary requires some DLLs
such as Unix and BigInt. That would be unfortunate. However
Windows is very bad at static linkage ;)

Another thought: you may have the wrong Ocaml.
You need the Ocaml built with MSVC++ NOT the Ocaml built
with MingW. Perhaps that's the problem?

It's all a pain: when I last built Felix on Windows some years ago
I had THREE Ocamls: MSVC++ version, Mingw version and 
a Cygwin version. It was VERY confusing. Even worse,
along came 64 bit windows .. and now I had FOUR Ocamls!

At that point .. I gave up and went sailing :)

You may need HOME environment variable. We tried to fix that
to use the Windows equivalent but may have missed some
places.

Of course "flx" does require MSVC++ if you try to compile a Felix
program to binary. It shouldn't need that if you use


        flx --nocc

(never tried it but that's supposed to just generate the C++).


> 
> 2)I was attempting to use the basic code generator (flxg.exe) without any 
> front-ends.  This is not at all straightforward,

No, it isn't. The best way to do that is to say:

        flx --echo hello

This will print the shell commands as it goes. Then you can pick out
the flxg command. I added COMMENTS  below (I should put these in
the actual flx output): Sorry this stiff is on OSX so you'll need to do the
equivalent on Windows:

~/felix>flx --echo hello
#FLX_INSTALL_DIR=/usr/local/lib/felix/felix-1.1.7dev
#PKGCONFIG='/usr/local/lib/felix/felix-1.1.7dev/bin/flx_pkgconfig'


RUN THE COMPILER flxg:

'/usr/local/lib/felix/felix-1.1.7dev/bin/flxg' -q --inline=100 
'--output_dir=/Users/johnskaller/.felix/cache/text' 
'--cache_dir=/Users/johnskaller/.felix/cache/binary' 
'-I/usr/local/lib/felix/felix-1.1.7dev/lib'  --syntax=@grammar/grammar.files 
--import=plat/flx.flxh  std web '/Users/johnskaller/felix/./hello'
Result code 0

GET THE CFLAGS NEEDED FOR LINKAGE

cmd='/usr/local/lib/felix/felix-1.1.7dev/bin/flx_pkgconfig' 
--path+=/usr/local/lib/felix/felix-1.1.7dev/config --field=cflags  
'@/Users/johnskaller/.felix/cache/text/Users/johnskaller/felix/./hello.resh'
output='-Ilib/rtl'

GET THE REQUIRED #INCLUDE FILES

cmd='/usr/local/lib/felix/felix-1.1.7dev/bin/flx_pkgconfig' 
--path+=/usr/local/lib/felix/felix-1.1.7dev/config --field=includes  
'@/Users/johnskaller/.felix/cache/text/Users/johnskaller/felix/./hello.resh'
output='"flx_ioutil.hpp" "flx_rtl.hpp" <iostream> <cstdio> <cstddef> <cassert> 
<climits> <string> "flx_gc.hpp"'

GET ANY SPECIAL DRIVER EXECUTABLE REQUIRED (default is flx_run)

cmd='/usr/local/lib/felix/felix-1.1.7dev/bin/flx_pkgconfig' 
--path+=/usr/local/lib/felix/felix-1.1.7dev/config --field=flx_requires_driver  
'@/Users/johnskaller/.felix/cache/text/Users/johnskaller/felix/./hello.resh'
output=''

GET REQUIRED DLLS:

cmd='/usr/local/lib/felix/felix-1.1.7dev/bin/flx_pkgconfig' -r 
--path+=/usr/local/lib/felix/felix-1.1.7dev/config --field=provides_dlib 
--field=requires_dlibs  flx_run 
'@/Users/johnskaller/.felix/cache/text/Users/johnskaller/felix/./hello.resh'
output='-lflx_pthread_dynamic -lflx_gc_dynamic -ljudy_dynamic -lflx_dynamic 
-lflx_exceptions_dynamic'

REPORT ON THE ABOVE:

//RESOURCE 
FILE=/Users/johnskaller/.felix/cache/text/Users/johnskaller/felix/./hello.resh
//INCLUDE_DIRS= -Ilib/rtl
//INCLUDE_FILES= "flx_ioutil.hpp" "flx_rtl.hpp" <iostream> <cstdio> <cstddef> 
<cassert> <climits> <string> "flx_gc.hpp"
//DYNAMIC DRIVER EXE =/usr/local/lib/felix/felix-1.1.7dev/bin/flx_run
//LINK_STRING=-L/usr/local/lib/felix/felix-1.1.7dev/lib/rtl  
-lflx_pthread_dynamic -lflx_gc_dynamic -ljudy_dynamic -lflx_dynamic 
-lflx_exceptions_dynamic

COMPILE THE GENERATED CODE:

/usr/local/bin/clang++ -c -fno-common -fno-strict-aliasing -fPIC    -Wall 
-Wfatal-errors -Wno-invalid-offsetof -Wno-logical-op-parentheses 
-Wno-bitwise-op-parentheses -Wno-parentheses-equality -Wno-return-stack-address 
-Wno-tautological-compare -Wno-return-type-c-linkage -Wno-unused-variable -fPIC 
 -O3 -fomit-frame-pointer  -DTARGET_BUILD 
'-I/usr/local/lib/felix/felix-1.1.7dev/lib/rtl' 
'-I/usr/local/lib/felix/felix-1.1.7dev/config/target'  -Ilib/rtl   
'/Users/johnskaller/.felix/cache/text/Users/johnskaller/felix/./hello.cpp' -o 
'/Users/johnskaller/.felix/cache/text/Users/johnskaller/felix/./hello.os'
Result code 0

LINK THE GENERATED BINARY:

/usr/local/bin/clang++ -fno-common -fno-strict-aliasing -dynamiclib     -O3 
-fomit-frame-pointer   
'/Users/johnskaller/.felix/cache/text/Users/johnskaller/felix/./hello.os' -o 
'/Users/johnskaller/felix/./hello.dylib' 
-L/usr/local/lib/felix/felix-1.1.7dev/lib/rtl  -lflx_pthread_dynamic 
-lflx_gc_dynamic -ljudy_dynamic -lflx_dynamic -lflx_exceptions_dynamic
Result code 0

RUN THE GENERATED PROGRAM:

env 
DYLD_LIBRARY_PATH=/usr/local/lib/felix/felix-1.1.7dev/lib/rtl:$DYLD_LIBRARY_PATH
 /usr/local/lib/felix/felix-1.1.7dev/bin/flx_run 
'/Users/johnskaller/felix/./hello.dylib' 

OUTPUT OF THE PROGRAM:

Hello
Result code 0


> and I have yet to get a program that prints "Hello World" to compile.  I did
> this because I was trying to discover the bare minimum set of files needed 
> for an implementation of "Felix" to exist.

All you need is flxg.exe...

However the "bare minumum" does not include any grammar!
So that's a bit "barer" than you really thought :) And of course,
no standard library. Here's a breakdown of the flxg command above:
(sorry comment after instead of before this time:)

'/usr/local/lib/felix/felix-1.1.7dev/bin/flxg'   

RUN THE COMPILER

-q 

TELL IT TO SHUT UP

--inline=100 

SPECIFY HOW AGGRESSIVELY TO INLINE

'--output_dir=/Users/johnskaller/.felix/cache/text' 

TELL IT WHERE TO PUT THE GENERATED TEXT

'--cache_dir=/Users/johnskaller/.felix/cache/binary' 

SPECIFY WHERE TO PUT GENERATED BINARY 
FELIX CACHES THE GRAMMAR AUTOMATON, 
PRECOMPILED STANDARD LIBRARIES, AND
THE PARSE OF EVERY FILE

'-I/usr/local/lib/felix/felix-1.1.7dev/lib'  

THE USUAL INCLUDE FILE DIRECTORY

--syntax=@grammar/grammar.files 

THE NAME OF THE TOP LEVEL GRAMMAR FILE

--import=plat/flx.flxh  

ANY EXTRA STUFF TO BE PASTED AT THE TOP OF EVERY FILE
INCLUDES MACROS TO SET THE PLATFORM

std web '/Users/johnskaller/felix/./hello'

THE CODE TO COMPILE. THE FIRST TWO ARE THE STANDARD
LIBRARY AND THE WEB SUPPORT LIBRARY. THE LAST ONE
IS THE "MAIN PROGRAM"

*** NOTE: Felix does not generate programs. It's a *library* generator.
What you think is a Felix program is just the initialisation phase
of a library.

Also it doesn't include platform dependent  linkage, to translate
abstract resources into platform ones you also need

        flx_pkgconfig

and you need a set of *.fpc files, like those in 

        FLX_INSTALL/config/*.fpc

Without this translation you will get a generated

        filename.resh

and the C++ header will include

        #include "filename.includes"

but that file isn't generated by flxg.


--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to