Comments (8)
I'm having trouble understanding why the number of arguments affect how it's parsed. I've only studied one way of parsing, and that's top down LL(1). It seemed to me as long as the grammar of the language didn't have any ambiguity, was context free, not left recursive, then the parser would be able to handle it. Also what do you mean by the value of the function, it's name, memory location?
I think I'm thinking about it differently because I'm imagining it being compiled and not interpreted, which my implementation might be.
from -g-pl.
It seemed to me as long as the grammar of the language didn't have any ambiguity
The problem here is that the grammar of the language HAD ambiguity.
Previously,
>foo >bar bat baz
was ambiguous between the following:
- foo() bar() bat baz
- foo(bar()) bat baz
- foo(bar(), bat) baz
- foo(bar(), bat baz)
- foo() bar(bat) baz
- foo() bar(bat, baz)
- foo(bar(bat)) baz
- foo(bar(bat), baz)
- foo(bar(bat, baz))
And the actual result would be determined based on how many parameters foo and bar take, respectively.
Now, with the addition of semicolons, it would be
>foo >bar bat; baz;
Which makes it clear that foo(bar(bat), baz) is meant, and nothing else.
from -g-pl.
ah i see, so how the hell does perl do it lol? there is always the option of adding parens, which I'm not entirely against.
from -g-pl.
perl is interpreted and slow as shit for a reason :)
Edit: Doesn't perl force parentheses where it would be ambiguous otherwise?
from -g-pl.
For the reference, my implementation is basically working. The hello world compiles except for three parts:
- I don't have a comparison function yet so >is name "nand" fails
- I don't remove comments yet so those fail
- I don't have any “gb2” yet so that fails
Otherwise, the rest is working fully.
from -g-pl.
Update: I added a comparison function now, so now the only issue I still need to solve is comments and gb2. :)
from -g-pl.
damn you work fast
from -g-pl.
I'm closing this. If we get any better ideas later on, open a new issue.
from -g-pl.
Related Issues (17)
- Multiline comments HOT 2
- OP function (aka main) HOT 5
- Allow global execution or not? HOT 10
- Repetition HOT 16
- gb2 needs a rework HOT 5
- Recursion HOT 1
- Thread on /g/ HOT 4
- Partial application HOT 1
- Easier conditional? HOT 3
- Array structure HOT 9
- Switch statement HOT 1
- Parsing diagram HOT 3
- "100% accurate" form for functions HOT 1
- Boolean HOT 3
- Finite State Machine and Lexer HOT 6
- Infix Operators vs Functions HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from -g-pl.