Comments (5)
Hey,
Its unlikely this is a bug and more likely there is something wrong with your grammar somewhere. To me your actual regex looks okay but you might have issues elsewhere in your grammar. You can take a look at these other issues (#29, #12, #10) for people who have had similar issues.
- Dan
from mpc.
@orangeduck My problem seems to be different. Here is my full grammar.
Int = mpc_new("int");
Double = mpc_new("double");
Symbol = mpc_new("symbol");
String = mpc_new("string");
Generator = mpc_new("generator");
Comment = mpc_new("comment");
Sexpr = mpc_new("sexpr");
List = mpc_new("list");
Expr = mpc_new("expr");
Lispy = mpc_new("lispy");
mpca_lang(MPCA_LANG_DEFAULT," \
int : /-?[0-9]+/ ; \
double : /-?[0-9]+\\.[0-9]+/; \
symbol : /[a-zA-Z0-9_+\\-^%*\\/\\\\=<>!&]+/ ; \
generator : '{' <expr> '|' <list> '}'; \
string : /\"(\\\\.|[^\"])*\"/ ; \
comment : /#[^\r\n]*/ ; \
sexpr : '(' <expr>* ')' ; \
list : '[' <expr>* ']' ; \
expr : <int> | <symbol> | <string> \
| <comment> | <sexpr> | <list> ; \
lispy : /^/ <expr>* /$/ ; ",
Int, Double, Symbol, Generator, String, Comment, Sexpr, List, Expr, Lispy);
Sorry for bothering you.
from mpc.
Looks like you haven't included your double
rule as an option for an expr
. Also make sure you list it as an option before int
see: https://github.com/orangeduck/mpc#backtracking-isnt-working
from mpc.
@orangeduck Thank you so much.
from mpc.
@LambdaProgrammer Can you please post your latest grammar in which you implemented Double numbers?
@orangeduck I'll really request you to make a repository in which you do all the bonus tasks in your book and explain regex in a bit more detail, just in case people get stuck.
:)
from mpc.
Related Issues (20)
- Implementation of `mpcf_all_free` not seen in mpc.c HOT 1
- In theory: Can MPC parse C? HOT 2
- scan coverity findings HOT 1
- Add support for arm64 architecture. HOT 4
- CMakeLists.txt suggestion HOT 6
- Release: GNU Guix
- Segmentation fault and timeout occur at mpca_lang_st() HOT 1
- Does the order of definitions matter in languages? HOT 2
- Mix parsers and AST HOT 3
- Greedy matching causes token matching issue HOT 2
- What about MPC now? HOT 1
- "-static" does not work on newer MacOS due to crt0
- make install does not work on newer MacOS (install command/folders)
- dependency errors issue HOT 9
- shared state and multi-threaded use HOT 2
- parser for """long string""" ? HOT 2
- Make include guards unique
- Completion of error handling
- memory leak in mpca_lang function
- Unicode and regexs etc HOT 1
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 mpc.