[pure-lang-svn] SF.net SVN: pure-lang: [306] pure/trunk/examples/poor.c
Status: Beta
Brought to you by:
agraef
From: <ag...@us...> - 2008-06-24 22:27:54
|
Revision: 306 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=306&view=rev Author: agraef Date: 2008-06-24 15:28:02 -0700 (Tue, 24 Jun 2008) Log Message: ----------- Comment changes. Modified Paths: -------------- pure/trunk/examples/poor.c Modified: pure/trunk/examples/poor.c =================================================================== --- pure/trunk/examples/poor.c 2008-06-24 15:57:36 UTC (rev 305) +++ pure/trunk/examples/poor.c 2008-06-24 22:28:02 UTC (rev 306) @@ -1,18 +1,24 @@ -/* Poor man's Pure interpreter. */ +/* Poor man's Pure interpreter. 2008-06-24 AG */ -/* This is an example for the C/C++->Pure interface. It implements a silly - little command loop which reads Pure code, evaluates it, and prints the - results. Compile this with 'gcc -o poor poor.c -lpure', and run as - './poor args...'. You can use the same command line options as with the - real Pure interpreter, including any Pure scripts to be loaded at startup. +/* This is an example for calling Pure from C/C++ applications. Using the + public runtime API of Pure 0.5 or later, it implements a little command + loop which reads lines of Pure code from standard input, evaluates them and + prints the results, until it encounters end-of-file. - Please note that the interface to the interpreter, as provided by the - public runtime API, is rather minimalistic right now. In particular, the - interpreter will always run in non-interactive mode (thus none of the - interactive commands will work) and eval() will only return the last - computed expression. */ + Compile this with 'gcc -o poor poor.c -lpure', and run the resulting + executable as './poor [args ...]'. You can use the same command line + arguments as with the real Pure interpreter, including any Pure scripts to + be loaded at startup. Input is line-oriented, so you can't continue + definitions across lines, but in return you don't have to terminate each + line with a ';' either, the eval() function already takes care of that. + Please note that the interpreter interface provided by the runtime API is + rather minimalistic right now. In particular, the interpreter always runs + in non-interactive mode (thus none of the interactive commands will work) + and eval() only returns the result of the last computed expression (this is + what gets printed in the read-eval-print loop). */ + #include <stdio.h> #include <pure/runtime.h> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |