V S P | 1 Nov 05:23
Favicon

Re: [Q] simple translator from Lua to Java Script and PHP

Hi,
I need some more directions,
I reviewed the web page with list of LuaGrammar stuff
and I tried to get something simple working to see
which ones I could use as base

so:
a) Luabalanced -- works however it recognizes only top-level
things -- like nested comments/tables/lists.  It does not have
an AST representation (it was not its goal anyways)

b)looked at luafish
http://lua-users.org/wiki/LuaFish
The last comment said that the most recent work
is using gg/mlp from metalua.

I installed the [luaanalyze-20080925b.tar.gz]
got it to run on the example file -- no problems.
However, there is no documentations/samples on how to use this
(since this is workin in progress).  And I am having difficulties
figuring out out the
basic APIs to walk through the AST, and assign actions (if I need
any for translation).

c) Still having difficulties to get metalua to run on windows
(but the metalua's gg/mlp works in the luaanalyse above -- so I am
thinking when Fabian has time for getting the whole metalua support
for windows/vs 2005/lua 5.1.4 -- I will at least get some knowledge
of dealing with AST using luaanlyze)

(Continue reading)

KHMan | 1 Nov 08:40
Picon

Re: [Q] simple translator from Lua to Java Script and PHP

V S P wrote:
> [snip]
> I installed the [luaanalyze-20080925b.tar.gz]
> got it to run on the example file -- no problems.
> However, there is no documentations/samples on how to use this
> (since this is workin in progress).  And I am having difficulties
> figuring out out the
> basic APIs to walk through the AST, and assign actions (if I need
> any for translation).

Many of the things listed in the LuaGrammar page are likely to be 
experimental stuff. As such, if you prefer an actively supported 
project and something that looks like a complete piece of 
software, then Fabien's metalua is definitely a good choice.

> c) Still having difficulties to get metalua to run on windows
> (but the metalua's gg/mlp works in the luaanalyse above -- so I am
> thinking when Fabian has time for getting the whole metalua support
> for windows/vs 2005/lua 5.1.4 -- I will at least get some knowledge
> of dealing with AST using luaanlyze)

If this is a stand-alone project, why not get MinGW up and 
running, since metalua has the correct Makefiles and config for that.

> d) the other projects listed there were not actively worked on
> (or may be I missed some) 

This is a rather small niche area, so you're not likely to see 
very active development. For example, I fiddle with Yueliang when 
I feel like it, or when prompted by the requirements of other 
(Continue reading)

V S P | 1 Nov 09:04
Favicon

Re: [Q] simple translator from Lua to Java Script and PHP

Ok,

thank you,
downloading LuaSrcDiet

In the mean time, using luaanalyze example
I got an AST using Metalua's parser/lexer the one
that's part of the luaanalyze (it seems as though
Metalua's lua parser/lexer can be used outside
of metalua itself -- and that's how luaanalyze is working,
so it eliminates any dependency on C compilation, platform /etc,
but yet gives me an already working Lua parser/lexer with line numbering
)

So I am going through that now ...  I can see
all the operators, and I think, I can even the function call
(tag== 'call' ) !

I will try to walk that tree using recursive calls just
like luaanalyze find_vars and build
'translation' blocks', then for each block type I will do the
translation code ... Will see how this will work out

... just downloaded....

It looks like your LuaSrcDiet already did the organization into
 blocks, but used a different parser/lexer to get there...
may be it will be simpler for me than building them myself from
the AST tree metalua's parser/lexer....

(Continue reading)

Florian Weimer | 1 Nov 17:25
Picon

Re: guarantees of exception safety in Lua

* David Given:

> In a desperate attempt to bring things back on topic, I'll point out
> that it would be possible to make a no-dynamic-allocation Lua subset,
> but it wouldn't be very like what we'd consider to be Lua: no table
> creation, no assignment to arbitrary table keys, and a very limited
> amount of function nesting. It'd probably be relatively straightforward
> to compile it to machine code, TBH, because it wouldn't support any of
> the dynamic features that make Lua Lua... I wonder if such a thing would
> be useful?

It could be used to implement parts of Lua.  Scheme48 does something
similar.  Pypy has got some non-dynamic Python subset as well, IIRC.

Ali Polatel | 1 Nov 20:31
Picon
Favicon
Gravatar

Match the beginning of the string with lpeg

^^ is it possible?
I know you can match the end of the string with -lpeg.P(1).
Is there any way you can match a pattern only at the beginning of the
string?

--

-- 
Regards,
Ali Polatel
Peter Cawley | 1 Nov 21:15
Favicon

Re: Match the beginning of the string with lpeg

LPEG always matches the pattern at the start of the string, you need
to explicitly tell it otherwise to match elsewhere in the string.

2008/11/1 Ali Polatel <polatel <at> itu.edu.tr>:
> ^^ is it possible?
> I know you can match the end of the string with -lpeg.P(1).
> Is there any way you can match a pattern only at the beginning of the
> string?
>
> --
> Regards,
> Ali Polatel
>

Ali Polatel | 1 Nov 21:49
Picon
Favicon
Gravatar

Re: Match the beginning of the string with lpeg

Peter Cawley yazmış:
> LPEG always matches the pattern at the start of the string, you need
> to explicitly tell it otherwise to match elsewhere in the string.
> 

Ah didn't know, thanks and sorry for the noise :)

--

-- 
Regards,
Ali Polatel
Picon

Re: "Random" delays in execution

Jerome,

Thanks for the effort you took. Please comment out lines 83 to 86 in
your Lua.c file and try again (those lines are the my patch to "fix" the
problem). Use the Lua functions to print mem usage per iteration.

Max

Peter Jacobi | 1 Nov 22:21

Lua fails Knuth's "man or boy" test?!

Dear All,

With the intention of announcing a positive result, I just tried
Knuth's "man or boy" test from ye olde Algol days with
Lua, but my test program doesn't return the correct -67
but rather -299.

As far as I understand it, the test checks whether closures
are still working under recursion.

I modeled the program closely after the JavaScript one, which
itself was taken from the Wikipedia article (with minor
modifications).

http://en.wikipedia.org/wiki/Man_or_boy_test

I append both at the bottom of the mail.

Did I miss something when writing the Lua test?

*Should* Lua return the -67 result or has it different
closure semantics for some valid reason?

Regards,
Peter

Lua:

--- begin of manorboy.lua ---
function A (k, x1, x2, x3, x4, x5)
(Continue reading)

Bogdan Marinescu | 1 Nov 22:28
Picon
Gravatar

[ANN] eLua 0.5 released

Hi,

eLua is an effort to bring the Lua programming language in the embedded world (MCUs). It is meant to be a complete MCU development environment. It currently runs on a number of ARM variants, as well as Cortex (and i386 as a proof of concept). Version 0.5 was just released, this is the changelog:

* Added support for STR7 CPUs from ST
* Added TCP/IP support using the uIP stack
* Added support for console and shell over TCP/IP instead of serial link
* Added the "net" module (eLua's interface to TCP/IP functions)
* Added the "cpu" module (eLua's interface to the target CPU)
* New samples: morse.lua (Morse code encoder), lhttpd.lua (Lua scripting HTTP
  server)
* Added support for cross-compiling Lua code (compile on PC, run on target)
* XMODEM can now receive Lua bytecode in addition to Lua source code
* The XMODEM buffer is now dynamic (grows as needed) instead of fixed size
* Project documentation updated

Best,
Bogdan


Gmane