haifenghuang / magpie Goto Github PK
View Code? Open in Web Editor NEW:bird: Successor of my monkey Interpreter(support for class, linq, sql, net, http, fmt, json and A realtime syntax highlighting REPL).
License: MIT License
:bird: Successor of my monkey Interpreter(support for class, linq, sql, net, http, fmt, json and A realtime syntax highlighting REPL).
License: MIT License
tcp的read方法阻塞,内部好像是调用阻塞的go socket函数,能不能改成magpie语言层上while循环手动从缓冲区read()读取数据
We are compiler lover, can i add your qq or wechat ?
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!
Please add multiline code blocks to the REPL. It would be very convenient.
>>> fn sum(x, y) {
... return x + y
... }
>>>
instead of:
>>> fn sum(x, y) { return x + y }
The magpie is amazing! Thanks!
@haifenghuang Have you planned to make Magpie compilable or adding bytecode compiled?
I saw ok programming language and it would be nice to see Magpie become compilable programming language.
You can add something like this:
from module include *
function() // instead of module.function()
The magpie is amazing! Thanks!
When I use json.readFile(). How do I check the type is an array or an object?
@haifenghuang When do you want to implement interface, public, private, protected keywords?
I ask because interface, public, private and protected keywords available, but they do not work.
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?
Instead of displaying an error, REPL continues to read input:
magpie>> include thismoduledoesnotexists
...
...
I think this is because of #5.
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
).
In fact, I want to run app in background, such as
app &
but it was blocked.
Is there go-routine feature?
Use case description:
MAIN: for (i=0;...) { for (j=0;....) { if (....) { break MAIN } } }
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.
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>>
@haifenghuang Why stdin >> variable
method scans only a char, not a line in REPL?
Also stdin.read()
too
This is only in REPL, if running this code from file, everything works correctly.
@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)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.