Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
--- flua.lua - top level stuff: compile a demo to an engine file in C --- and a bytecode file in Nasm. -- -- Copyright (C) 2001 Eduardo Ochs. -- Author: Eduardo Ochs <edrx@mat.puc-rio.br> -- Version: 0.02 (2001apr29). -- -- This program was copylefted to prevent against patent psychopaths; -- if you want a version with any other license you'll have to write -- it yourself. More formally, -- -- This program is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License as -- published by the Free Software Foundation; either version 2 of the -- License, or (at your option) any later version. -- Flua is an experimental Forth-like language, built on top of Lua, C -- and Nasm. It is an implementation of the ideas of my (old) "Crim" -- project. -- -- Related files: -- (find-flua "flua-comp.lua") -- (find-flua "flua-demos.lua") -- (find-flua "flua-lua.lua") -- (find-flua "inc.lua") -- «.command_line» (to "command_line") DBG = getenv("DBG") dofile("inc.lua") dofile("flua-comp.lua") dofile("flua-prims.lua") dofile("flua-lua.lua") -- dofile("flua-demos.lua") -- (find-flua "inc.lua") -- (find-flua "flua-comp.lua") -- (find-flua "flua-prims.lua") -- (find-flua "flua-lua.lua") -- (find-flua "flua-demos.lua") action["%"] = function() tick(getword()) end action["g%"] = function() gtick(getword()) end action["\\"] = function() local _; _, _, rest = strfind(rest, "\n(.*)"); end action["--"] = action["\\"] action[":"] = function() tick(getword()); f("COL:") end action["g:"] = function() gtick(getword()); f("COL:") end action[":RSR"] = function() gtick(getword()); f("RSR:") end --%%%%% --% --% Run the demo selected by arg[2] (if arg[1] is "do_demo(arg[2])") --% --%%%%% function do_demo(demoname) demodir = "" enginefile = format("%s%s.engine.c", demodir, demoname) bytecodefile = format("%s%s.bytecode.asm", demodir, demoname) Cskelfile = "skel.engine.c" nasmskelfile = "skel.bytecode.asm" -- getglobal("flua_" .. demoname)() px(demoname) f(readfile(demoname .. ".flua")) build_engine_strings() -- dump_engine_strings() px(enginefile) process_C_skeleton(Cskelfile, enginefile) printf("Wrote engine file: %s\n", enginefile) process_nasm_skeleton(nasmskelfile, bytecodefile) printf("Wrote bytecode file: %s\n", bytecodefile) end -- «command_line» (to ".command_line") -- (find-flua "Makefile") -- (find-flua "flua-demos.lua" "flua_demo1") -- (find-flua "flua-demos.lua" "flua_demo2") -- (find-flua "flua-demos.lua" "flua_demo3") -- (find-flua "flua-demos.lua" "flua_demo4") -- (find-flua "flua-demos.lua" "flua_demo5") -- px(arg) dostring(arg[1]) ignore_this = [[ #* cd ~/LUA/flua-0.03/ lua -f flua.lua 'do_demo(arg[2])' demo1 #* ]] -- -- Local Variables: -- coding: no-conversion -- ee-anchor-format: "«%s»" -- ee-charset-indicator: "Ñ" -- End: