Giter Club home page Giter Club logo

brat's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

brat's Issues

Wrong lua being used.

build.sh tries to find "luajit" as "lua". Should be a simple fix.
As a workaround, I've uninstalled the normal lua, and made a symlink on my PATH.

missing requirements for mac os snow leopard ( -> documentation)

Testsystem:

fresh install on:
mac os x v. 10.6.7
gcc version 4.2.1 (Apple Inc. build 5664)
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
treetop (1.4.9)

$ ./build

Error Message 1.:

make -C src/oniguruma -f rex_onig.mak
gcc -bundle -undefined dynamic_lookup -o rex_onig.so.2.4 lonig.o lonig_f.o ../common.o -L/Users/ben/src/brat/presidentbeef-brat-d73f103/bin/lua//lib -lonig
ld: library not found for -lonig

Solution:

brew install oniguruma

Error Message 2

command 'tt' is missing

Hack:

I hard coded tt path ~/.gem/... into build.sh

regards
ben

Parsing of function literals with argument lists in comma-lists

Sorry for so many issues; I really like Brat.

I was interested in extending true?, null? etc so they give the condition argument to their true/false branches, so that true? 4 { x | p x } would print 4. I have added the feature: catb0t@65fc9dd

However, I think have found a parser bug with literals and functions in argument lists. There is no combination of parentheses and commas that allows this to parse correctly; there is always a name error for x:

true? 4 { x | x }

However these give 4:

true? 4 { 4 }
f = { x | x }
true? 4 ->f

Similarly, this gives true (which is not the condition):

null? null { x | x } { x | x } 

I understand that probably parses as null?(null({ x | x }({x | x}))), but adding commas like so is also a name error

null? null, { x | x }, { x | x } # x is not declared

Again, it can be worked around by not using a literal:

f = { x | x } 
null? null, ->f, ->f # => null

In some cases even ->f doesn't help; if f is undeclared then false? 4, 0, ->f (or any comma combination of that) will do nothing but wait for a keypress in interactive mode.

If f is declared:

f = {x | x}
false? 4, 0, ->f
#=> Argument error: function expected 1 argument(s) but was given 0.

But this is a problem with the way 0, ->f is parsed, because false? definitely gives the condition to the function branch.

Make real exceptions

Right now, errors are thrown using $throw(string).

Instead, use an exception object with a type and message. Standardize a bit.

tt: команда не найдена

when i start ./install.sh
mkdir: невозможно создать каталог «/usr/lib/brat/»: Файл существует
Building fresh parser...
./install.sh: line 12: tt: команда не найдена

Mutual recursion is only broken inside tests

I'm not familiar with Brat's internals, so I can't debug it any further. But, I am not sure if you noticed this, and maybe it helps debugging.

The code is pretty much directly taken from test-examples.brat, but with the testy parts commented out.

If you run this code as-is, it prints true true

#*
include :assert

setup name: :x {
  test "mutual recursion" {
*#
    female = null #yes, this is necessary

    male = { n |
      true? n == 0
      { 0 }
      { n - female male(n - 1) }
    }

    female = { n |
      true? n == 0
      { 1 }
      { n - male female(n - 1 ) }
    }

    p ([1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 8, 8, 9, 9, 10, 11, 11, 12, 13] == {
      0.to(20).map! { n | female n }
    }())

    p ([0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, 12] == {
      0.to(20).map! { n | male n }
    }())

#*
    assert_equal [1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 8, 8, 9, 9, 10, 11, 11, 12, 13] {
      0.to(20).map! { n | female n }
    }

    assert_equal [0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, 12] {
      0.to(20).map! { n | male n }
    }
  }
}
*#

But if you uncomment the test framework, then it prints

Test failure(s):

	1. 'mutual recursion': mrec.lua:888: attempt to call local '_temp6' (a table value)

So, user code can use mutual recursion as long as it isn't inside setup / test?

Building on Mac osX

I've tried for several hours to build on macOSx Mojave 10.14.5

I have fixed a few problems building Lua, but the build fails with

env MACOSX_DEPLOYMENT_TARGET=10.3 gcc -bundle -undefined dynamic_lookup -o md5.so lmd5.o -lcrypto
ld: library not found for -lcrypto
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [md5.so] Error 1

While Building Oniguruma is being executed.

I added make MACOSX_DEPLOYMENT_TARGET=10.6 DEFAULT_CC=clang -j8 PREFIX=$BRATPATH/bin/lua to line 41 in the build file which helped a few errors.

I currently have ./configure && CFLAGS="-I/usr/local/Cellar/openssl/1.0.2k/include /usr/local/Cellar//openssl/1.0.2s/lib" make MACOSX_DEPLOYMENT_TARGET=10.6 DEFAULT_CC=clang -j8 on line 50 with no success.

Any pointers? I love Brat and would enjoy using it on my Mac, and hopefully contributing more.

String interpolation in interactive mode

This may be intended behaviour, but the string interpolation "#{value}" functionality doesn't seem to work in the interactive repl.

# Interactive Brat
brat:1> a = 1
#=> 1
brat:2> p "#{a}"
#=> [string "interactive"]:12: attempt to index global '_table' (a nil value)

This does, however, work if you create a file and run brat my_file.brat.

install woes

mac os x v. 10.6.7
gcc version 4.2.1 (Apple Inc. build 5664)
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
treetop (1.4.9)


./build.sh => ok
./tests => ok
sudo ./install => ok


Problems:

Brat doesn't find its interpreter:

$ brat
env: lua: No such file or directory

manual solution:

export PATH=$PATH:/usr/lib/brat/lua/bin/

Brats Lua doesn't find its libraries:

$ brat
lua: /usr/lib/brat//brat:13: module 'lfs' not found:
no field package.preload['lfs']
no file './lfs.lua'
no file '/homes/ben/src/brat/brat/bin/lua/share/luajit-2.0.0-beta7/lfs.lua'
no file '/usr/local/share/lua/5.1/lfs.lua'
no file '/usr/local/share/lua/5.1/lfs/init.lua'
no file '/homes/ben/src/brat/brat/bin/lua/share/lua/5.1/lfs.lua'
no file '/homes/ben/src/brat/brat/bin/lua/share/lua/5.1/lfs/init.lua'
no file '../core/lfs.lua'
no file '../stdlib/lfs.lua'
no file '../lib/lfs.lua'
no file './lfs.so'
no file '/usr/local/lib/lua/5.1/lfs.so'
no file '/homes/ben/src/brat/brat/bin/lua/lib/lua/5.1/lfs.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '../lib/lfs.so'
 stack traceback:
[C]: in function 'require'
/usr/lib/brat//brat:13: in main chunk
[C]: ?

I've tried to fix this by hacking in bin/brat, but had no luck.

Please have a look into this.
thanks
ben

Confusing error from parentheses / comma in the wrong place

These work:

p p(1)
p (p 1) 
p p 1
p p, 1
p 9 8 
p 9, 8

These don't

p (p, 1) 
(9, 8)
(9 8) 
9 8
p (9 8)
p (9, 8) 

I think some of these are valid syntax.
They all fail with the same inexplicable error:

lua: Method error: false has no method called 'ast'.
stack traceback:
	[C]: in function '_error'
	stdlib/parser/brat2lua.lua:547: in function 'run'
	bin/brat:108: in function 'interactive'
	bin/brat:142: in main chunk
	[C]: at 0x5606b9b5d150

Function "find" doesn't work

The builtin function "find" doesnt seem to work, atleast not in the try brat online editor.

Code:
"amogus".find "gus"

Ouput:

/home/brat/brat/core/core.lua:2184: attempt to call upvalue 'block' (a table value)
stack traceback:
/home/brat/brat/core/core.lua: in function 'block'
/home/brat/brat/core/core.lua:4440: in function 'each'
/home/brat/brat/core/core.lua:2189: in function '_m__temp1_find'
[string "string"]:41: in function '_m__temp3_run_underparsed'
[string "string"]:209: in function <[string "string"]:12>
stack traceback:
[string "string"]:336: in main chunk
[C]: in function 'xpcall'
/home/brat/brat/core/core.lua:1304: in function 'protect'
/home/brat/brat/bin/brat:137: in function 'run_string'
/home/brat/brat/bin/brat:162: in main chunk
[C]: at 0x5650922ed5b0

Interestingly .include? works but not find

Encountering error with lfs.so

I tried deploying Brat on a MacOS X thinking it would work cause MacOS X is Unix based.

When running brat command, I already obtained the error message :

lua: error loading module 'lfs' from file '/Developer/usr/bin/brat/lib/lfs.so':
dlopen(/Developer/usr/bin/brat/lib/lfs.so, 2): no suitable image found. Did find:
/Developer/usr/bin/brat/lib/lfs.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x01 0x01 0x01 0x00
stack traceback:

C: in function 'require'
/Developer/usr/bin/brat/bin/brat:13: in main chunk

I know Brat is not supposed to be deployed on another OS than Linux but maybe it's not a big fix to make it deployable on MacOS :D

@tchaoo°

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.