Coder Social home page Coder Social logo

haifenghuang / magpie Goto Github PK

View Code? Open in Web Editor NEW
130.0 9.0 16.0 17.93 MB

:bird: Successor of my monkey Interpreter(support for class, linq, sql, net, http, fmt, json and A realtime syntax highlighting REPL).

License: MIT License

Go 96.07% Shell 0.13% HTML 2.07% JavaScript 1.29% Vim Script 0.44%
programming-language scripting-languages scripting-language interpreted-languages interpreter object-oriented pratt-parser language linq golang

magpie's Issues

tcp的read方法阻塞

tcp的read方法阻塞,内部好像是调用阻塞的go socket函数,能不能改成magpie语言层上while循环手动从缓冲区read()读取数据

Hello

We are compiler lover, can i add your qq or wechat ?

Errors in tests.

@haifenghuang

Running httpclient.mp causes a Syntax Error:

$ ./magpie examples/httpclient.mp
Syntax Error: <examples/httpclient.mp:1:4> - expected next token to be (, got ) instead
$

The magpie is amazing! Thanks!

Question: let keyword

@haifenghuang

When I trying to just define variable I got this error:

Syntax Error: <file:2:0> - expected token to be comma, got EOF instead.

But it works if I'll add ; at the end of let a.

Is it possible to fix this?

I found a way to add support for highlight on Windows

@haifenghuang

Colors in magpie does not works on windows:

magpie>> [1mlet[m

But I found a way to fix this. If you add this in the main() function in main.go (only for windows, on other platform there will be an error) then the colors will work:

handle := syscall.Handle(os.Stdout.Fd())
kernel32DLL := syscall.NewLazyDLL("kernel32.dll")
setConsoleModeProc := kernel32DLL.NewProc("SetConsoleMode")
setConsoleModeProc.Call(uintptr(handle), 0x0001|0x0002|0x0004)

On windows it successfully compiled, but on Linux/Darwin/other:

undefined: syscall.Handle
undefined: syscall.NewLazyDLL

I do not know how to make go compiler to compile this part of code only for windows because there is no preprocessor in golang (#ifdef).

Could Break to Label?

Use case description:

MAIN: for (i=0;...) {
   for (j=0;....) {
      if (....) {
         break MAIN
      }
    }
}

howto get properties from json object

Hi,
For non-nested json string.....just Key=Value type...
After json unmarshel input string, how can I get the properties of json object?
My means is how to get "keys" from the json object?
Or....How to translate json to hash?
Thx.

hash vivification not working

i am looking for your code and i found that following functionality is not working in you code.
magpie>> let hash={}
magpie>> hash
magpie>> print(hash)
magpie>> hash["one"]["two"]
1index error: type NIL_OBJ is not indexable
magpie>> hash["one"]["two"]++
1index error: type NIL_OBJ is not indexable
1unsupported operator for postfix expression:'++' and type: NIL_OBJ
magpie>>

Compilation succeed for Windows but failed for other platforms.

@haifenghuang Now I can't compile it:

Building REPL...(magpie)
# github.com/peterh/liner
src/github.com/peterh/liner/highlighter.go:79:19: undefined: isInwinConsole
src/github.com/peterh/liner/highlighter.go:91:16: undefined: getConsoleTextAttr
src/github.com/peterh/liner/highlighter.go:430:3: undefined: setConsoleTextAttr
src/github.com/peterh/liner/highlighter.go:432:3: undefined: setConsoleTextAttr

NOTE: only magpie.exe successfully compiled.

root@rr-345-w8z67$ sh run.sh

Building REPL...(magpie)
# github.com/peterh/liner
src/github.com/peterh/liner/highlighter.go:79:19: undefined: isInwinConsole
src/github.com/peterh/liner/highlighter.go:91:16: undefined: getConsoleTextAttr
src/github.com/peterh/liner/highlighter.go:430:3: undefined: setConsoleTextAttr
src/github.com/peterh/liner/highlighter.go:432:3: undefined: setConsoleTextAttr
Building REPL(win)...(magpie.exe)
Building mdoc...(mdoc)
Building Formatter...(fmt)
Building Highlighter...(highlight)

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.