Comments (10)
I found out why asm
blocks were erroring out, and now I can pass all the tests! (But I had to edit some of the more contrived tests.) It's on the rule_whitespace
branch again.
As you said, rules written as op {a}, {b}
will require the space after the comma. We can bet someone is relying on the old behavior, so this would be a breaking change... I wonder if that would be acceptable?
from customasm.
I was finally able to get all the tests to pass under the new whitespace rules, and it's now available on v0.12!
It's a breaking change and there might be unexpected issues, so let's see if it's worth it.
from customasm.
It looks like customasm is ignoring whitespace, for example:
#ruledef
{
rl a => 0x0000
rla => 0x01
}
rl a
rla
produces 01 01
, not 00 00 01
. I've been trying to implement the z80 instruction set in customasm, and have run into a few instances like above.
from customasm.
Yeah, it's ignoring whitespace. It was the easier route to take since the assembler uses a weird mix of lexical tokens and raw characters for instruction matching. I've gotta find a way to make whitespace count again without breaking backward-compatibility!
from customasm.
I've been poking at the source tonight, and I'm not sure this is fixable without breaking at least this test.
It seems reasonable to me that the rule should only match r0000
and friends, without the space, but I'm not sure why the behavior is there in the first place.
from customasm.
It was specifically for "glued" rules that the token/character duality arose in the parser. That test reflects a use-case where you may need to supply a complex expression to a glued argument -- the space is needed for the expression parser to work.
How did you go about solving the issue in general? I think we can add a small exception for that test, so all would be good!
from customasm.
I haven't implemented it yet, but I was planning on adding a whitespace variant to the rule parts. Looking at this more closely, I'm not sure that would work. I might try it anyway, and see what damage it causes.
from customasm.
I've played a bit with whitespaces rules, and it seems it'll be difficult to add it without breaking something in the way! It seems to break asm
blocks, unfortunately, which might be a tough fix.
I've also tried simplifying this whole token/character duality thing to just using tokens directly, but that breaks a few other tests, and I'm not sure whether anyone is relying on that behavior. But this seems to be the most promising path, I think.
(This is all on the rule_whitespace
branch!)
from customasm.
I've done some exploring as well, attaching an after_ignorable
flag to all tokens and using this later to introduce a Space
pattern to rules. Originally this flag was in the parser, but I also ran into an issue with asm
blocks!
This passes all tests, but has the unusual side effect that rules written as op {a}, {b}
now require the space after the comma -- basically, any space present in the rule must be present to match, but extra spaces are ignored. Unfortunately this means it doesn't solve my rl a
/ rla
problem, and I don't know any way around that.
It's hard to track what spaces are important across parameter boundaries! The spaces between symbols are probably always important, but how can you tell if the space in the rule op {a}
is between symbols?
from customasm.
I think so, but I'm obviously pretty biased here. It's unfortunate that these two tests broke, though. Back-compatibility would be a little bit easier to bear if a rule like op {a},{b}
also accepted things like op a, b
.
from customasm.
Related Issues (20)
- Autoamtically resolve "multiple matches with the same output size" errors HOT 2
- VSCode Syntax highlighting not working. HOT 2
- Add option for addressing units when outputting intelhex? HOT 1
- Error with misaligned string ends. HOT 5
- `#struct` Directive HOT 2
- Way to Include Raw Binary File HOT 1
- EBNF for customasm syntax HOT 4
- Feature Request: Compile for MacOS in release section. HOT 2
- Relative Jumps? HOT 2
- Are there any stability guarantees if I use customasm as a library? HOT 3
- Stack overflow / Index out of bounds with recursive rules
- v0.11 syntax error using a'b instead of b`a syntax for a constant with a specified width HOT 2
- Feature: adding space separated format
- Internal Overhaul
- "Unknown variable" when forwarding primitive arguments HOT 3
- no-color option HOT 2
- no match for instruction found HOT 2
- Feature Request: Different number base options for annotated text output. HOT 3
- Calculate `.len` of labels automatically
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 customasm.