Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Roseseed
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Wanxin Li
Roseseed
Commits
cf1032eb
Commit
cf1032eb
authored
5 years ago
by
expan
Browse files
Options
Downloads
Plain Diff
Merge branch 'atoms' of git.uwaterloo.ca:gweddell/LDI into atoms
parents
788a0672
962b9579
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.vscode/ipch/29adc1225747c2d1/mmap_address.bin
+0
-0
0 additions, 0 deletions
.vscode/ipch/29adc1225747c2d1/mmap_address.bin
Parser
+0
-0
0 additions, 0 deletions
Parser
parser.c
+5
-5
5 additions, 5 deletions
parser.c
with
5 additions
and
5 deletions
.vscode/ipch/29adc1225747c2d1/mmap_address.bin
0 → 100644
+
0
−
0
View file @
cf1032eb
File added
This diff is collapsed.
Click to expand it.
Parser
+
0
−
0
View file @
cf1032eb
No preview for this file type
This diff is collapsed.
Click to expand it.
parser.c
+
5
−
5
View file @
cf1032eb
...
...
@@ -6,6 +6,7 @@
cons_cell
*
parse
(
char
*
input
,
int
size
)
{
if
(
input
[
0
]
==
NULL
)
{
assert
(
size
==
0
);
return
NULL
;
}
if
(
input
[
0
]
==
'('
)
{
...
...
@@ -14,14 +15,14 @@ cons_cell* parse(char* input, int size) {
end
--
;
}
char
buffer
[
end
];
strncpy
(
buffer
,
input
[
1
],
end
-
1
);
strncpy
(
buffer
,
&
input
[
1
],
end
-
1
);
cons_cell
*
car_cons
=
parse
(
buffer
,
end
-
1
);
int
next_char
=
end
+
1
;
while
(
input
[
next_char
]
==
' '
&&
input
[
next_char
]
!=
NULL
)
{
next_char
++
;
}
char
buffer_next
[
500
];
strncpy
(
buffer_next
,
input
[
next_char
],
size
-
next_char
);
strncpy
(
buffer_next
,
&
input
[
next_char
],
size
-
next_char
);
cons_cell
*
cdr_cons
=
parse
(
buffer_next
,
size
-
next_char
);
return
create_cons_cell
(
car_cons
,
cdr_cons
);
}
else
{
...
...
@@ -46,15 +47,14 @@ cons_cell* parse(char* input, int size) {
int
main
()
{
char
str
[
500
];
printf
(
"Enter the json-string to parse: "
);
printf
(
"Enter the json-string to parse:
\n
"
);
scanf
(
"%s"
,
str
);
printf
(
"You entered: %s"
,
str
);
printf
(
"You entered: %s
\n
"
,
str
);
int
size
=
0
;
while
(
str
[
size
]
!=
NULL
)
{
size
++
;
}
size
++
;
cons_cell
*
cons
=
parse
(
str
,
size
);
print_cons_tree
(
cons
);
return
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment